|
@@ -1,16 +1,36 @@
|
|
|
import pandas as pd
|
|
|
-from LIB.BACKEND import DBManager # 以相对路径的方式引入!!!!!
|
|
|
-import V_1_0_0.core as core # 以相对路径的方式引入!!!!!
|
|
|
-
|
|
|
+import time
|
|
|
+from LIB.BACKEND import DBManager,Log # 以相对路径的方式引入!!!!!
|
|
|
+from V_1_0_0 import core # 以相对路径的方式引入!!!!!
|
|
|
+import os
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
- sn = "PK10001A326000123"
|
|
|
+ # 获取环境变量
|
|
|
+ env_dist = os.environ
|
|
|
+ host = env_dist.get("HOST", '120.25.223.1')
|
|
|
+ port = env_dist.get("PORT", '4901')
|
|
|
+ db = env_dist.get("DB", 'ali')
|
|
|
+ user = env_dist.get("ROOT", 'root')
|
|
|
+ password = env_dist.get("PASSWORD", '123456')
|
|
|
+
|
|
|
+ # 日志配置
|
|
|
+ now_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()).replace(":","_")
|
|
|
+ log_path = 'log/' + now_str
|
|
|
+ if not os.path.exists(log_path):
|
|
|
+ os.makedirs(log_path)
|
|
|
+ log = Log.Mylog(log_name='cal_sor', log_level = 'info')
|
|
|
+ log.set_file_hl(file_name='{}/info.log'.format(log_path), log_level='info', size=1024* 1024 * 100)
|
|
|
+ log.set_file_hl(file_name='{}/error.log'.format(log_path), log_level='error', size=1024* 1024 * 100)
|
|
|
+ logger = log.get_logger()
|
|
|
+
|
|
|
+ # 准备算法数据
|
|
|
+ sn = "PK10001A326000123"
|
|
|
st = '2021-07-06 00:00:00'
|
|
|
et = '2021-07-07 20:00:00'
|
|
|
-
|
|
|
dbManager = DBManager.DBManager()
|
|
|
df_data = dbManager.get_data(sn=sn, start_time=st, end_time=et, data_groups=['bms', 'gps', 'accum', 'system'])
|
|
|
-#
|
|
|
df_bms = df_data['bms']
|
|
|
+ # 调用核心算法
|
|
|
calSor = core.CalSor();
|
|
|
+ # 接收算法结果
|
|
|
print(calSor.calSor(df_bms,df_bms))
|