qingfeng 2 years ago
parent
commit
fa4357f7e7

BIN
LIB/BACKEND/__pycache__/Log.cpython-38.pyc


BIN
LIB/MIDDLE/CellStateEstimation/Common/V1_0_1/__pycache__/BatParam.cpython-38.pyc


BIN
LIB/MIDDLE/CellStateEstimation/Common/V1_0_1/__pycache__/log.cpython-38.pyc


+ 4 - 5
LIB/MIDDLE/CellStateEstimation/Common/V1_0_1/log.py

@@ -17,11 +17,10 @@ class Mylog:
                 Level=logging.WARNING
             else:
                 Level=logging.ERROR
-<<<<<<< HEAD
-        logging.basicConfig(filename=r'D:\01WorkSpace\python\data_analyze_platform\USER\SPF\01qixiang\101Log\\'+self.name, level=Level,format='%(asctime)s - %(levelname)s - %(message)s')
-=======
-        logging.basicConfig(filename=r'D:\deploy\python_platform\data_analyze_platform\log_test\\'+self.name, level=Level,format='%(asctime)s - %(levelname)s - %(message)s')
->>>>>>> master
+
+        logging.basicConfig(filename=r'D:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\101Log\\'+self.name, level=Level,format='%(asctime)s - %(levelname)s - %(message)s')
+
+
 
 
     def logopt(self,*info):

+ 1 - 1
USER/SPF/01qixiang/06BatSafetyAlarm/CBMSSafetyAlarm.py

@@ -208,7 +208,7 @@ class SafetyAlarm:
                 else:
                     pass
             
-            #热失控故障判断........................................................................................................................
+             #热失控故障判断........................................................................................................................
             df_bms_ram=pd.DataFrame(columns=['time', 'sn', 'packvolt',  'cellvolt', 'celltemp'])
             df_bms_ram.loc[0]=[self.bmstime[0], self.sn, packvolt2, cellvolt2, temp2]
             df_ram_alarm=self.df_ram_alarm

BIN
USER/SPF/01qixiang/06BatSafetyAlarm/__pycache__/CBMSSafetyAlarm.cpython-38.pyc


+ 9 - 48
USER/SPF/01qixiang/06BatSafetyAlarm/main.py

@@ -3,32 +3,20 @@ import pymysql
 import datetime
 import pandas as pd
 import multiprocessing
-from LIB.BACKEND import DBManager, Log
+from LIB.BACKEND import DBManager
 import time, datetime
 from apscheduler.schedulers.blocking import BlockingScheduler
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import log
 
 
 #...................................电池包电芯安全诊断函数......................................................................................................................
-<<<<<<< HEAD
 def diag_cal(sn_list, df_bms_ram, df_alarm_ram,now_time):
 
     start=time.time()
     end_time=now_time
-    start_time=now_time-datetime.timedelta(seconds=60)
+    start_time=now_time-datetime.timedelta(seconds=70)
     start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
     end_time=now_time.strftime('%Y-%m-%d %H:%M:%S')
-=======
-def diag_cal(sn_list, df_bms_ram, df_alarm_ram):
-
-    start=time.time()
-    now_time=datetime.datetime.now() #-datetime.timedelta(seconds=3600*24+3600*14.6)
-    start_time=now_time-datetime.timedelta(seconds=180)
-    start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
-    end_time=now_time.strftime('%Y-%m-%d %H:%M:%S')
-    start_time='2021-10-31 09:30:30'
-    end_time='2021-10-31 09:31:30'
->>>>>>> master
 
     #数据库配置
     host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
@@ -108,12 +96,9 @@ def diag_cal(sn_list, df_bms_ram, df_alarm_ram):
     return df_bms_ram,df_alarm_ram
 #...................................................主进程...........................................................................................................
 def mainprocess():
-<<<<<<< HEAD
     global df_bms_ram1, df_bms_ram2, df_alarm_ram1, df_alarm_ram2, SNnums, now_time
     now_time=now_time+datetime.timedelta(seconds=60)
-=======
-    global df_bms_ram1, df_bms_ram2, df_alarm_ram1, df_alarm_ram2, SNnums
->>>>>>> master
+
     process = 2
     pool = multiprocessing.Pool(processes = process)
 
@@ -124,11 +109,7 @@ def mainprocess():
         sn_list = SNnums[i]
         df_bms_ram=ram_list1[i]
         df_alarm_ram=ram_list2[i]
-<<<<<<< HEAD
         df_res=pool.apply_async(diag_cal, (sn_list,df_bms_ram,df_alarm_ram,now_time)).get()
-=======
-        df_res=pool.apply_async(diag_cal, (sn_list,df_bms_ram,df_alarm_ram)).get()
->>>>>>> master
         res_list.append(df_res)
     
     pool.close()
@@ -142,7 +123,6 @@ def mainprocess():
 #...............................................主函数起定时作用.......................................................................................................................
 if __name__ == "__main__":
     
-<<<<<<< HEAD
     # excelpath=r'D:\Develop\User\Songpengfei\data_analyze_platform\WORK\01qixiang\sn-20210903.xlsx'
     # SNdata_6060 = pd.read_excel(excelpath, sheet_name='科易6060')
     # SNdata_6040 = pd.read_excel(excelpath, sheet_name='科易6040')
@@ -157,25 +137,8 @@ if __name__ == "__main__":
     # SNnums_C7255=SNdata_C7255['SN号'].tolist()
     # SNnums_U7255=SNdata_U7255['SN号'].tolist()
     # SNnums=[SNnums_L7255 + SNnums_C7255 + SNnums_U7255 + SNnums_4840, SNnums_6040 + SNnums_6060]
-    SNnums=[['PK504B10100004487'], []]
-    now_time=datetime.datetime.strptime('2022-5-24 19:49:00','%Y-%m-%d %H:%M:%S')
-=======
-    excelpath=r'D:\Develop\User\Songpengfei\data_analyze_platform\WORK\01qixiang\sn-20210903.xlsx'
-    SNdata_6060 = pd.read_excel(excelpath, sheet_name='科易6060')
-    SNdata_6040 = pd.read_excel(excelpath, sheet_name='科易6040')
-    SNdata_4840 = pd.read_excel(excelpath, sheet_name='科易4840')
-    SNdata_L7255 = pd.read_excel(excelpath, sheet_name='格林美-力信7255')
-    SNdata_C7255 = pd.read_excel(excelpath, sheet_name='格林美-CATL7255')
-    SNdata_U7255 = pd.read_excel(excelpath, sheet_name='优旦7255')
-    SNnums_6060=SNdata_6060['SN号'].tolist()
-    SNnums_6040=SNdata_6040['SN号'].tolist()
-    SNnums_4840=SNdata_4840['SN号'].tolist()
-    SNnums_L7255=SNdata_L7255['SN号'].tolist()
-    SNnums_C7255=SNdata_C7255['SN号'].tolist()
-    SNnums_U7255=SNdata_U7255['SN号'].tolist()
-    SNnums=[SNnums_L7255 + SNnums_C7255 + SNnums_U7255 + SNnums_4840, SNnums_6040 + SNnums_6060]
-    SNnums=[['MGMCLN750N215N049','PK504B10100004328'], ['PK500A20100000752','PK504B10100004387']]
->>>>>>> master
+    SNnums=[['PK504B10100004312'], []]
+    now_time=datetime.datetime.strptime('2022-8-11 9:22:00','%Y-%m-%d %H:%M:%S')
     
     mylog=log.Mylog('log_diag.txt','error')
     mylog.logcfg()
@@ -186,14 +149,12 @@ if __name__ == "__main__":
     df_alarm_ram1=pd.DataFrame(columns=['sn','time','safetywarning1','safetywarning2'])
     df_alarm_ram2=pd.DataFrame(columns=['sn','time','safetywarning1','safetywarning2'])
 
-    mainprocess()
+    # mainprocess()
     #定时任务.......................................................................................................................................................................
     scheduler = BlockingScheduler()
-<<<<<<< HEAD
-    scheduler.add_job(mainprocess, 'interval', seconds=0.1, id='diag_job')
-=======
-    scheduler.add_job(mainprocess, 'interval', seconds=180, id='diag_job')
->>>>>>> master
+
+    scheduler.add_job(mainprocess, 'interval', seconds=1, id='diag_job')
+
 
     try:  
         scheduler.start()

+ 63 - 0
USER/SPF/01qixiang/101Log/log_diag.txt

@@ -0,0 +1,63 @@
+2022-08-15 17:04:11,829 - ERROR - Job "mainprocess (trigger: interval[0:00:01], next run at: 2022-08-15 17:04:11 CST)" raised an exception
+multiprocessing.pool.RemoteTraceback: 
+"""
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 125, in worker
+    result = (True, func(*args, **kwds))
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 57, in diag_cal
+    dbManager = DBManager.DBManager()
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'
+"""
+
+The above exception was the direct cause of the following exception:
+
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job
+    retval = job.func(*job.args, **job.kwargs)
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 112, in mainprocess
+    df_res=pool.apply_async(diag_cal, (sn_list,df_bms_ram,df_alarm_ram,now_time)).get()
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 771, in get
+    raise self._value
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'
+2022-08-15 17:04:15,704 - ERROR - Job "mainprocess (trigger: interval[0:00:01], next run at: 2022-08-15 17:04:15 CST)" raised an exception
+multiprocessing.pool.RemoteTraceback: 
+"""
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 125, in worker
+    result = (True, func(*args, **kwds))
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 57, in diag_cal
+    dbManager = DBManager.DBManager()
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'
+"""
+
+The above exception was the direct cause of the following exception:
+
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job
+    retval = job.func(*job.args, **job.kwargs)
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 112, in mainprocess
+    df_res=pool.apply_async(diag_cal, (sn_list,df_bms_ram,df_alarm_ram,now_time)).get()
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 771, in get
+    raise self._value
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'
+2022-08-15 17:04:19,457 - ERROR - Job "mainprocess (trigger: interval[0:00:01], next run at: 2022-08-15 17:04:19 CST)" raised an exception
+multiprocessing.pool.RemoteTraceback: 
+"""
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 125, in worker
+    result = (True, func(*args, **kwds))
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 57, in diag_cal
+    dbManager = DBManager.DBManager()
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'
+"""
+
+The above exception was the direct cause of the following exception:
+
+Traceback (most recent call last):
+  File "C:\ProgramData\Anaconda3\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job
+    retval = job.func(*job.args, **job.kwargs)
+  File "d:\00WorkSpace\01Python\data_analyze_platform\USER\SPF\01qixiang\06BatSafetyAlarm\main.py", line 112, in mainprocess
+    df_res=pool.apply_async(diag_cal, (sn_list,df_bms_ram,df_alarm_ram,now_time)).get()
+  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 771, in get
+    raise self._value
+AttributeError: module 'LIB.BACKEND.DBManager' has no attribute 'DBManager'