|
@@ -472,7 +472,7 @@ class BaseAnalyst(ABC):
|
|
|
|
|
|
return dataFrame
|
|
return dataFrame
|
|
|
|
|
|
- def loadData(self, dataBatchNum: str, timeGranularity: str, turbineCode: str, select: str, condition: str) -> pd.DataFrame:
|
|
|
|
|
|
+ def loadData(self, powerFarmID: str, timeGranularity: str, turbineCode: str, select: str, condition: str) -> pd.DataFrame:
|
|
selectStr = ", ".join(f"{field}" for field in select)
|
|
selectStr = ", ".join(f"{field}" for field in select)
|
|
businessDB: DatabaseUtil = GetBusinessDbUtil()
|
|
businessDB: DatabaseUtil = GetBusinessDbUtil()
|
|
with businessDB.session_scope() as session:
|
|
with businessDB.session_scope() as session:
|
|
@@ -480,7 +480,7 @@ class BaseAnalyst(ABC):
|
|
# FROM `{dataBatchNum}_{timeGranularity}`
|
|
# FROM `{dataBatchNum}_{timeGranularity}`
|
|
# WHERE wind_turbine_number IN ({turbineCode}) AND {condition}"""
|
|
# WHERE wind_turbine_number IN ({turbineCode}) AND {condition}"""
|
|
query_text = f"""SELECT {selectStr}
|
|
query_text = f"""SELECT {selectStr}
|
|
- FROM `{dataBatchNum}_{timeGranularity}`
|
|
|
|
|
|
+ FROM `{powerFarmID}_{timeGranularity}`
|
|
WHERE wind_turbine_number IN ({turbineCode}) AND {condition}"""
|
|
WHERE wind_turbine_number IN ({turbineCode}) AND {condition}"""
|
|
query_result = session.execute(text(query_text)).fetchall()
|
|
query_result = session.execute(text(query_text)).fetchall()
|
|
|
|
|
|
@@ -499,7 +499,7 @@ class BaseAnalyst(ABC):
|
|
# Get turbine model info
|
|
# Get turbine model info
|
|
currTurbineModelInfo = self.common.getTurbineModelByTurbine(currTurbineInfo, self.turbineModelInfo)
|
|
currTurbineModelInfo = self.common.getTurbineModelByTurbine(currTurbineInfo, self.turbineModelInfo)
|
|
# select DB data
|
|
# select DB data
|
|
- dataFrameOfTurbine = self.loadData(dataBatchNum, timeGranularity, f"'{turbineCode}'", select, customCondition)
|
|
|
|
|
|
+ dataFrameOfTurbine = self.loadData(powerFarmID, timeGranularity, f"'{turbineCode}'", select, customCondition)
|
|
|
|
|
|
if dataFrameOfTurbine.empty:
|
|
if dataFrameOfTurbine.empty:
|
|
self.logger.warning(f"{turbineCode} Time Granulary: {timeGranularity} scada data is empty.")
|
|
self.logger.warning(f"{turbineCode} Time Granulary: {timeGranularity} scada data is empty.")
|