|
@@ -70,6 +70,7 @@ class DataBase(object):
|
|
self.end_stamp = timestr_to_timestamp(str(self.end))
|
|
self.end_stamp = timestr_to_timestamp(str(self.end))
|
|
self.database = arg.database
|
|
self.database = arg.database
|
|
self.towerloc = arg.towerloc
|
|
self.towerloc = arg.towerloc
|
|
|
|
+ self.turbineloc = arg.turbineloc
|
|
self.dataloc = arg.dataloc
|
|
self.dataloc = arg.dataloc
|
|
|
|
|
|
def clear_data(self):
|
|
def clear_data(self):
|
|
@@ -253,18 +254,20 @@ class DataBase(object):
|
|
:param database:
|
|
:param database:
|
|
:return:
|
|
:return:
|
|
"""
|
|
"""
|
|
- number = self.opt.usable_power['turbine_id']
|
|
|
|
- # 机头数据
|
|
|
|
- engine = self.create_database()
|
|
|
|
|
|
+ for number in self.turbineloc:
|
|
|
|
+ # number = self.opt.usable_power['turbine_id']
|
|
|
|
+ # 机头数据
|
|
|
|
+ engine = self.create_database()
|
|
|
|
|
|
- self.logger.info("导出风机{}的数据".format(number))
|
|
|
|
- sql_turbine = "select C_TIME, C_WS, C_WD, C_ACTIVE_POWER from t_wind_turbine_status_data " \
|
|
|
|
- "WHERE C_EQUIPMENT_NO=" + str(number) + " and C_TIME between '{}' and '{}'".format(self.begin, self.end) # + " and C_WS>0 and C_ACTIVE_POWER>0"
|
|
|
|
- turbine = self.exec_sql(sql_turbine, engine)
|
|
|
|
- turbine = cleaning(turbine, 'cdq', cols=['C_WS', 'C_ACTIVE_POWER'], dup=False)
|
|
|
|
- turbine = turbine[turbine['C_TIME'].dt.strftime('%M').isin(['00', '15', '30', '45'])]
|
|
|
|
- # 直接导出所有数据
|
|
|
|
- saveData("turbine-{}.csv".format(number), turbine)
|
|
|
|
|
|
+ print("导出风机{}的数据".format(number))
|
|
|
|
+ sql_turbine = "select C_TIME, C_WS, C_WD, C_ACTIVE_POWER from t_wind_turbine_status_data " \
|
|
|
|
+ "WHERE C_EQUIPMENT_NO=" + str(number) + " and C_TIME between '{}' and '{}'".format(self.begin, self.end) # + " and C_WS>0 and C_ACTIVE_POWER>0"
|
|
|
|
+ turbine = self.exec_sql(sql_turbine, engine)
|
|
|
|
+ turbine = cleaning(turbine, 'cdq', cols=['C_WS', 'C_ACTIVE_POWER'], dup=False)
|
|
|
|
+ turbine['C_TIME'] = pd.to_datetime(turbine['C_TIME'])
|
|
|
|
+ turbine = turbine[turbine['C_TIME'].dt.strftime('%M').isin(['00', '15', '30', '45'])]
|
|
|
|
+ # 直接导出所有数据
|
|
|
|
+ saveData("turbine-15/turbine-{}.csv".format(number), turbine)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -276,12 +279,12 @@ class DataBase(object):
|
|
"""
|
|
"""
|
|
self.clear_data()
|
|
self.clear_data()
|
|
try:
|
|
try:
|
|
- self.get_process_power()
|
|
|
|
- self.get_process_dq()
|
|
|
|
|
|
+ # self.get_process_power()
|
|
|
|
+ # self.get_process_dq()
|
|
# self.get_process_cdq()
|
|
# self.get_process_cdq()
|
|
- self.get_process_NWP()
|
|
|
|
- self.get_process_tower()
|
|
|
|
- # self.get_process_turbine()
|
|
|
|
|
|
+ # self.get_process_NWP()
|
|
|
|
+ # self.get_process_tower()
|
|
|
|
+ self.get_process_turbine()
|
|
self.indep_process()
|
|
self.indep_process()
|
|
except Exception as e:
|
|
except Exception as e:
|
|
print("导出数据出错:{}".format(e.args))
|
|
print("导出数据出错:{}".format(e.args))
|