Browse Source

日志完善+write_image方法删除

chenhongyan1989 2 weeks ago
parent
commit
329d508a89
35 changed files with 561 additions and 482 deletions
  1. 69 1
      README.md
  2. 2 2
      conf_template/appConfig.json
  3. 7 5
      dataAnalysisBehavior/behavior/baseAnalyst.py
  4. 1 1
      dataAnalysisBehavior/setup.py
  5. 11 11
      dataAnalysisBusiness/algorithm/cpAnalyst.py
  6. 14 14
      dataAnalysisBusiness/algorithm/cpTrendAnalyst.py
  7. 11 11
      dataAnalysisBusiness/algorithm/cpWindSpeedAnalyst.py
  8. 12 12
      dataAnalysisBusiness/algorithm/dataIntegrityOfSecondAnalyst.py
  9. 24 15
      dataAnalysisBusiness/algorithm/dataProcessor.py
  10. 25 25
      dataAnalysisBusiness/algorithm/generatorSpeedPowerAnalyst.py
  11. 25 25
      dataAnalysisBusiness/algorithm/generatorSpeedTorqueAnalyst.py
  12. 17 17
      dataAnalysisBusiness/algorithm/minPitchAnalyst.py
  13. 11 11
      dataAnalysisBusiness/algorithm/pitchGeneratorSpeedAnalyst.py
  14. 24 24
      dataAnalysisBusiness/algorithm/pitchPowerAnalyst.py
  15. 14 14
      dataAnalysisBusiness/algorithm/pitchTSRCpAnalyst.py
  16. 11 11
      dataAnalysisBusiness/algorithm/powerCurveAnalyst.py
  17. 18 18
      dataAnalysisBusiness/algorithm/powerScatter2DAnalyst.py
  18. 29 29
      dataAnalysisBusiness/algorithm/ratedPowerWindSpeedAnalyst.py
  19. 11 11
      dataAnalysisBusiness/algorithm/ratedWindSpeedAnalyst.py
  20. 24 24
      dataAnalysisBusiness/algorithm/temperatureEnvironmentAnalyst.py
  21. 31 31
      dataAnalysisBusiness/algorithm/temperatureLargeComponentsAnalyst.py
  22. 11 11
      dataAnalysisBusiness/algorithm/tsrAnalyst.py
  23. 11 11
      dataAnalysisBusiness/algorithm/tsrCpPowerAnalyst.py
  24. 11 11
      dataAnalysisBusiness/algorithm/tsrCpPowerScatterAnalyst.py
  25. 15 15
      dataAnalysisBusiness/algorithm/tsrTrendAnalyst.py
  26. 11 11
      dataAnalysisBusiness/algorithm/tsrWindSpeedAnalyst.py
  27. 17 17
      dataAnalysisBusiness/algorithm/windDirectionFrequencyAnalyst.py
  28. 11 11
      dataAnalysisBusiness/algorithm/windSpeedAnalyst.py
  29. 16 16
      dataAnalysisBusiness/algorithm/windSpeedFrequencyAnalyst.py
  30. 24 24
      dataAnalysisBusiness/algorithm/yawErrorAnalyst.py
  31. 32 32
      dataAnalysisBusiness/algorithm/yawErrorDensityAnalyst.py
  32. 1 1
      dataAnalysisBusiness/setup.py
  33. 8 8
      dataAnalysisService/setup.py
  34. 1 1
      dataContract/setup.py
  35. 1 1
      repositoryZN/setup.py

+ 69 - 1
README.md

@@ -112,4 +112,72 @@ pip download -r requirements.txt -d download
 此方案 验证未成功 ,保留以供继续研究
 1. pip install pip-tools pipreqs pipdeptree
 2. 执行命令 pipreqs [指定目录] --force  在 指定目录下 生成 requirements.txt 文件
-3. 执行命令 pip-compile requirements.txt --output-file=reqs.txt
+3. 执行命令 pip-compile requirements.txt --output-file=reqs.txt
+
+## 配置信息
+1. 禅道
+   http://106.120.102.238:19090
+
+2. 新git管理(gogs)
+   地址:http://106.120.102.238:63000
+   2.1 算法服务源代码(数据分析)地址:http://106.120.102.238:63000/zhzn/WTOAAM
+   2.2 故障诊断源代码地址:
+   2.2.1 轴承齿轮故障诊断源代码地址:http://106.120.102.238:63000/lcb/Auto_Diag
+   2.2.2 温度故障诊断源代码地址:http://106.120.102.238:63000/lcb/Temp_Diag
+   2.3 健康评估源代码地址:http://106.120.102.238:63000/lcb/Health_Evaluation
+   2.4 振动分析源代码地址:http://106.120.102.238:63000/lcb/CMS
+   2.5 大模型训练、微调验证源代码地址:http://106.120.102.238:63000/zhouyang.xie/deepseek_python
+
+3.数据库
+  地址(mysql):106.120.102.238:10336
+  业务数据库(测试)名:energy_data
+  业务数据库(生产)名:energy_data_prod
+  账户名:admin
+  密码:admin123456
+
+  地址(mysql):106.120.102.238:16306
+  基础数据库(测试)名:energy
+  基础数据库(生产)名:energy_prod
+  基础数据库(演示)名:energy_show
+  账户名:root
+  密码:admin123456
+
+  地址(TIDB):106.120.102.238:10336
+  业务数据库(测试)名:energy_data
+  业务数据库(生产)名:energy_data_prod
+  账户名:admin
+  密码:admin123456
+
+  地址(TIDB):106.120.102.238:16306
+  基础数据库(测试)名:energy
+  基础数据库(生产)名:energy_prod
+  基础数据库(演示)名:energy_show
+  账户名:root
+  密码:admin123456
+
+4.minio
+   4.1 开发
+   106.120.102.238:26900
+
+   4.2 生产
+   106.120.102.238:16900
+
+
+5. 产品(系统)环境
+   5.1 开发
+   http://106.120.102.238:58880
+    5.1.1 算法服务:
+     部署至192.168.50.235(内网IP)服务器,为Deamon服务(路径:/etc/systemd/system/wtoaamapi.service),纳入systemctl管理
+     程序目录:/data/source_code/WTOAAM
+
+    5.2 生产
+    http://106.120.102.238:18000
+     5.2.1 算法服务:
+      部署至192.168.50.233(内网IP)服务器,为Deamon服务(路径:/etc/systemd/system/wtoaamapi.service),纳入systemctl管理
+      程序目录:/data/source_code/WTOAAM_1.2.2
+
+    5.3 演示
+    http://106.120.102.238:28999
+     5.3.1 算法服务:
+      部署至192.168.50.233(内网IP)服务器,为Deamon服务(路径:/etc/systemd/system/wtoaamapi_show.service),纳入systemctl管理
+      程序目录:/data/source_code/WTOAAM_Show

+ 2 - 2
conf_template/appConfig.json

@@ -2,7 +2,7 @@
   "databaseConfig": {
     "businessFoundationDb": {
       "type": "mysql",
-      "url": "mysql+pymysql://admin:admin123456@106.120.102.238:16306/energy",
+      "url": "mysql+pymysql://admin:admin123456@106.120.102.238:16306/energy_show",
       "timeout": 30,
       "poolSize": 2,
       "maxPoolSize": 20,
@@ -11,7 +11,7 @@
     },
     "businessDb": {
       "type": "mysql",
-      "url": "mysql+pymysql://admin:admin123456@106.120.102.238:16306/energy_data",
+      "url": "mysql+pymysql://admin:admin123456@106.120.102.238:16306/energy_data_prod",
       "timeout": 30,
       "poolSize": 10,
       "maxPoolSize": 20,

+ 7 - 5
dataAnalysisBehavior/behavior/baseAnalyst.py

@@ -7,6 +7,7 @@ from urllib.parse import quote
 
 import numpy as np
 import pandas as pd
+import traceback
 from algorithmContract.confBusiness import *
 from algorithmContract.configAnalysis import ConfigAnalysis
 from algorithmContract.contract import Contract
@@ -391,7 +392,7 @@ class BaseAnalyst(ABC):
                 dataFrame[fieldGeneratorSpeed] = dataFrame[fieldGeneratorSpeed].fillna(
                     dataFrame[fieldRotorSpeed]*rotationalSpeedRatio)
                 # dataFrame[fieldGeneratorSpeed] = dataFrame[fieldRotorSpeed]*rotationalSpeedRatio
-                
+
 
     def recalculationOfRotorSpeed(self,turbineModelInfo: pd.Series, dataFrame: pd.DataFrame, fieldRotorSpeed, fieldGeneratorSpeed, rotationalSpeedRatio: float):
         """
@@ -554,7 +555,7 @@ class BaseAnalyst(ABC):
         #lab过滤
         self.selectLabCondition(conditions)
         return " AND ".join(conditions) if conditions else "1=1"
-    
+
     def selectFaultTimeCondition(self,conf: Contract, conditions: list[str]):
         """
         时间过滤条件组装
@@ -579,7 +580,7 @@ class BaseAnalyst(ABC):
         self.selectFaultTimeCondition(conf,conditions)
         #lab过滤
         self.selectLabCondition(conditions)
-        return " AND ".join(conditions) if conditions else "1=1"    
+        return " AND ".join(conditions) if conditions else "1=1"
 
     def processTurbineData(self, turbines, conf: Contract, select: str):
         try:
@@ -622,14 +623,15 @@ class BaseAnalyst(ABC):
                         f"{excption.message} Power Farm: {conf.dataContract.dataFilter.powerFarmID} Batch : {conf.dataContract.dataFilter.dataBatchNum} Time Granularity : {timeGranularity}")
                     raise excption
                 else:
+                    self.logger.info(f"data frame concat dataBatchNum: {dataBatchNum}  timeGranularity: {timeGranularity} dataFrameOfTurbines : {dataFrameOfTurbines}")
                     if Field_DeviceCode in dataFrameOfTurbines.columns and Field_CodeOfTurbine not in dataFrameOfTurbines.columns:
                         dataFrameOfTurbines = dataFrameOfTurbines.rename(columns={Field_DeviceCode: Field_CodeOfTurbine})
 
                     dictionary[timeGranularity] = dataFrameOfTurbines
-
             return dictionary
         except Exception as e:
-            self.logger.error(f"Error processing turbine data: {e}")
+            self.logger.error(f"Error processing turbine data:{e.message}")
+            traceback.format_exc()
             raise
 
     def addPropertyToDataFrame(self,dataFrameOfTurbine : pd.DataFrame, currTurbineInfo : pd.Series, currTurbineModelInfo: pd.Series):

+ 1 - 1
dataAnalysisBehavior/setup.py

@@ -41,7 +41,7 @@ class InstallCommand(install):
 setup(
     name='dataAnalysisBehavior',
     # version='1.2.202406281546',
-    version='1.2.202409251330',
+    version='1.2.202505131730',
     description='Data Analysis Behavior Package', # 描述信息
     author='Xie Zhou Yang', # 作者
     packages=find_packages(),

+ 11 - 11
dataAnalysisBusiness/algorithm/cpAnalyst.py

@@ -297,23 +297,23 @@ class CpAnalyst(AnalystWithGoodPoint):
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
 
             # 保存图像
-            pngFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # 保存HTML
             # htmlFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.html"
             # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
             # fig.write_html(htmlFilePath)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: turbineCode,
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: turbineCode,
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # 如果需要返回DataFrame,可以包含文件路径
             result_rows.append({

+ 14 - 14
dataAnalysisBusiness/algorithm/cpTrendAnalyst.py

@@ -120,8 +120,8 @@ class CpTrendAnalyst(AnalystWithGoodPoint):
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "风能利用系数时序分析",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "时间",
                 "yaixs": "风能利用系数",
                 "data": [{
@@ -137,14 +137,14 @@ class CpTrendAnalyst(AnalystWithGoodPoint):
                                 "x": medians.index.tolist(),  # 中位数的 x 轴数据
                                 "y": medians.values.tolist(),  # 中位数的 y 轴数据
                                 "mode":'markers',
-                                "color":'orange', 
+                                "color":'orange',
                                 "size":3
                                 }
-                        }] 
+                        }]
             }
             # 保存图像
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{currTurbineInfo[Field_NameOfTurbine]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{currTurbineInfo[Field_NameOfTurbine]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{currTurbineInfo[Field_NameOfTurbine]}.html")
             # fig.write_html(filePathOfHtml)
             # 将JSON对象保存到文件
@@ -162,14 +162,14 @@ class CpTrendAnalyst(AnalystWithGoodPoint):
                 Field_Return_FilePath: output_json_path,
                 Field_Return_IsSaveDatabase: True
             })
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: turbineCode,
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: turbineCode,
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 11 - 11
dataAnalysisBusiness/algorithm/cpWindSpeedAnalyst.py

@@ -227,23 +227,23 @@ class CpWindSpeedAnalyst(AnalystWithGoodPoint):
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
 
             # 保存图像
-            pngFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # 保存HTML
             # htmlFileName = f"{currTurbineInfo[Field_NameOfTurbine]}.html"
             # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
             # fig.write_html(htmlFilePath)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: currTurbineInfo[Field_CodeOfTurbine],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: currTurbineInfo[Field_CodeOfTurbine],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # 如果需要返回DataFrame,可以包含文件路径
             result_rows.append({

+ 12 - 12
dataAnalysisBusiness/algorithm/dataIntegrityOfSecondAnalyst.py

@@ -69,7 +69,7 @@ class DataIntegrityOfSecondAnalyst(AnalystNotFilter):
             plot_res = pd.concat([plot_res, group], axis=0, sort=False)
 
         return plot_res
-    
+
     def get_time_space(self,df, time_str):
         """
         :return: 查询时间间隔(单位:秒)
@@ -238,23 +238,23 @@ class DataIntegrityOfSecondAnalyst(AnalystNotFilter):
             json.dump(json_output, f, ensure_ascii=False, indent=4)
 
         # 保存图像
-        pngFileName = f'{farmName}数据完整度分析.png'
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig.write_image(pngFilePath, scale=3)
+        # pngFileName = f'{farmName}数据完整度分析.png'
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig.write_image(pngFilePath, scale=3)
 
         # 保存HTML
         # htmlFileName = f'{farmName}数据完整度分析.html'
         # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
         # fig.write_html(htmlFilePath)
 
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: Const_Output_Total,
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: Const_Output_Total,
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         result_rows.append({
             Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 24 - 15
dataAnalysisBusiness/algorithm/dataProcessor.py

@@ -65,7 +65,7 @@ class DataProcessor:
         timeGranularity = next(
             (config.scada for config in configs if config.className.lower() == type(analyst).__name__.lower()), None)
         return pd.DataFrame() if dictionary[timeGranularity].empty else dictionary[timeGranularity]
-    
+
     def singleTurbineDataNotify(self,analyst,conf:Contract,turbineCode:str):
             outputAnalysisDir = analyst.getOutputAnalysisDir()
             outputFilePath = r"{}/{}{}".format(outputAnalysisDir,
@@ -73,7 +73,7 @@ class DataProcessor:
             return analyst.analysisOfTurbine(
                  outputAnalysisDir, outputFilePath, conf, turbineCode)
 
-    def notifyOfTurbine(self,  conf: Contract, turbineCode: str) -> pd.DataFrame:        
+    def notifyOfTurbine(self,  conf: Contract, turbineCode: str) -> pd.DataFrame:
         results =[]
         maxWorkers = 4
         with concurrent.futures.ThreadPoolExecutor(max_workers=maxWorkers) as executor:
@@ -81,21 +81,27 @@ class DataProcessor:
                         executor.submit(self.singleTurbineDataNotify,analyst, conf,turbineCode)
                         for analyst in self._analysts
                     ]
-            
+
             for future in concurrent.futures.as_completed(futures):
                 try:
                     result = future.result()
                     results.append(result)
                 except Exception as exc:
                     raise exc
-                
+
         returnResult = pd.concat(results, ignore_index=True)
         return returnResult
-    
+
     def multiTubineDataNotify(self,analyst,conf:Contract,turbineCodes):
-        outputAnalysisDir = analyst.getOutputAnalysisDir()
-        return analyst.analysisOfTurbines(
-                outputAnalysisDir, conf,turbineCodes)
+        try:
+            outputAnalysisDir = analyst.getOutputAnalysisDir()
+            dataFram = analyst.analysisOfTurbines(outputAnalysisDir, conf,turbineCodes)
+            self.logger.info(f"analysis type execute result : dataFrame = {dataFram}")
+            return dataFram
+        except Exception as exception:
+            self.logger.info(f"analysis type execute error : {exception.message}")
+            traceback.format_exc()
+            raise exception
 
     def notifyOfTurbines(self, conf: Contract,turbineCodes) -> pd.DataFrame:
         results =[]
@@ -105,14 +111,17 @@ class DataProcessor:
                         executor.submit(self.multiTubineDataNotify,analyst, conf,turbineCodes)
                         for analyst in self._analysts
                     ]
-            
+            self.logger.info("Waiting for all futures to complete...")
             for future in concurrent.futures.as_completed(futures):
+                self.logger.info(f"future is : {future}")
                 try:
                     result = future.result()
                     results.append(result)
                 except Exception as exc:
+                    self.logger.info(f"future deal error. future : {future} , error is {exc.message}")
+                    traceback.format_exc()
                     raise exc
-                
+
         returnResult = pd.concat(results, ignore_index=True)
         return returnResult
 
@@ -188,8 +197,8 @@ class DataProcessor:
             with foundationDB.session_scope() as foundationSession:
                 outputProcessor.analysisState(
                     foundationSession, conf.dataContract.dataFilter.dataBatchNum, AnalysisState.Analyzing.value, analysisProgress=10)
-                        
-            # 机组筛选            
+
+            # 机组筛选
             turbines = self.getTurbines(conf,self.turbineInfo)
             # turbineSqlInStr = ", ".join(f"'{turbine}'" for turbine in turbines)  # 使用%s作为占位符,稍后可以替换为实际值
             # dictionary= self.processTurbineData(turbines,conf)
@@ -224,11 +233,11 @@ class DataProcessor:
             self.logger.info(
                 f"批次:{conf.dataContract.dataFilter.dataBatchNum} 完成请求发电性能分析、输出及更新状态")
         except (CustomError, Exception) as e:
+            self.logger.info(f" executeAnalysis error: {e.message}")
+            traceback.format_exc()
             try:
                 dbUtil = GetBusinessFoundationDbUtil()
-
                 ex = e if isinstance(e, CustomError) else CustomError(-1)
-
                 code = ex.code
                 message = ex.message
                 with dbUtil.session_scope() as session:
@@ -239,5 +248,5 @@ class DataProcessor:
                 error_message = ''.join(traceback.format_exception(e1))
                 # 记录异常信息
                 self.logger.error(f"捕获到异常: {error_message}")
-            
+
         return DataFrameOutput

+ 25 - 25
dataAnalysisBusiness/algorithm/generatorSpeedPowerAnalyst.py

@@ -30,7 +30,7 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
 
         turbrineInfos = self.common.getTurbineInfos(
             conf.dataContract.dataFilter.powerFarmID, turbineCodes, self.turbineInfo)
-        
+
         groupedOfTurbineModel = turbrineInfos.groupby(Field_MillTypeCode)
 
         returnDatas = []
@@ -137,16 +137,16 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
         engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
         if isinstance(engineTypeName, pd.Series):
             engineTypeName = engineTypeName.iloc[0]
-        
+
         print(dataFrame[Field_UnixYearMonth].head())
-        print(dataFrame[Field_UnixYearMonth].dtype)    
+        print(dataFrame[Field_UnixYearMonth].dtype)
         # 使用 apply() 对每个元素调用 datetime.fromtimestamp
         dataFrame[Field_UnixYearMonth]= dataFrame[Field_UnixYearMonth].apply(lambda x: datetime.fromtimestamp(x).strftime('%Y-%m'))
         # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和有功功率分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "功率(kW)",
             "data": [{
@@ -158,14 +158,14 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
                 "color": dataFrame[Field_UnixYearMonth].tolist(),
                 "colorbartitle": "时间",
                 "mode":'markers'
-            
+
         }]
         }
 
         # 保存图片
-        outputFilePathPNG = os.path.join(
-            outputAnalysisDir, f"{name[0]}.png")
-        fig.write_image(outputFilePathPNG, width=800, height=600, scale=3)
+        # outputFilePathPNG = os.path.join(
+        #     outputAnalysisDir, f"{name[0]}.png")
+        # fig.write_image(outputFilePathPNG, width=800, height=600, scale=3)
         # # 保存html
         # outputFileHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
         # fig.write_html(outputFileHtml)
@@ -184,14 +184,14 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
             Field_Return_FilePath: output_json_path,
             Field_Return_IsSaveDatabase: True
         })
-        result.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
-            Field_Return_FilePath: outputFilePathPNG,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
+        #     Field_Return_FilePath: outputFilePathPNG,
+        #     Field_Return_IsSaveDatabase: False
+        # })
         # result.append({
         #     Field_Return_TypeAnalyst: self.typeAnalyst(),
         #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
@@ -266,11 +266,11 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
         engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
         if isinstance(engineTypeName, pd.Series):
             engineTypeName = engineTypeName.iloc[0]
-        # 构建最终的JSON对象   
+        # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和有功功率分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "时间",
             "zaixs": "有功功率(kW)",
@@ -283,7 +283,7 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
                 "zData":dataFrame[Field_ActiverPower].tolist(),
                 "color": dataFrame[Field_YearMonth].tolist(),
                 "mode":'markers'
-            
+
         }]
         }
         # # 保存图像
@@ -427,11 +427,11 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
         engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
         if isinstance(engineTypeName, pd.Series):
             engineTypeName = engineTypeName.iloc[0]
-        # 构建最终的JSON对象   
+        # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和有功功率分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "机组",
             "zaixs": "有功功率(kw)",
@@ -442,7 +442,7 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
                 "zData":dataFrame[Field_ActiverPower].tolist(),
                 "color": dataFrame[Field_NameOfTurbine].tolist(),
                 "mode":'markers'
-            
+
         }]
         }
         # # 保存图像

+ 25 - 25
dataAnalysisBusiness/algorithm/generatorSpeedTorqueAnalyst.py

@@ -145,12 +145,12 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
 
         # 使用 apply() 对每个元素调用 datetime.fromtimestamp
         dataFrame['monthIntTime']=dataFrame['monthIntTime'].apply(lambda x: datetime.fromtimestamp(x).strftime('%Y-%m'))
-        
+
         # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和转矩分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "扭矩(N·m)",
             "data": [{
@@ -162,19 +162,19 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
                 "color": dataFrame['monthIntTime'].tolist(),
                 "colorbartitle": "时间",
                 "mode":'markers'
-            
+
         }]
         }
 
         # 保存图片
-        outputFilePathPNG = os.path.join(
-            outputAnalysisDir, f"{name[0]}.png")
-        fig.write_image(outputFilePathPNG, width=800, height=600, scale=3)
+        # outputFilePathPNG = os.path.join(
+        #     outputAnalysisDir, f"{name[0]}.png")
+        # fig.write_image(outputFilePathPNG, width=800, height=600, scale=3)
 
         # # 保存html
         # outputFileHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
         # fig.write_html(outputFileHtml)
-        
+
         # 将JSON对象保存到文件
         output_json_path = os.path.join(outputAnalysisDir, f"speed_torque{name[0]}.json")
         with open(output_json_path, 'w', encoding='utf-8') as f:
@@ -190,14 +190,14 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
             Field_Return_FilePath: output_json_path,
             Field_Return_IsSaveDatabase: True
         })
-        result.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
-            Field_Return_FilePath: outputFilePathPNG,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
+        #     Field_Return_FilePath: outputFilePathPNG,
+        #     Field_Return_IsSaveDatabase: False
+        # })
         # result.append({
         #     Field_Return_TypeAnalyst: self.typeAnalyst(),
         #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
@@ -264,7 +264,7 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
                 itemwidth=80  # Set the width of legend items to 50 pixels
             )
         )
-        
+
         # 确保从 Series 中提取的是具体的值
         engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
         if isinstance(engineTypeCode, pd.Series):
@@ -273,11 +273,11 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
         engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
         if isinstance(engineTypeName, pd.Series):
             engineTypeName = engineTypeName.iloc[0]
-        # 构建最终的JSON对象   
+        # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和转矩分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "时间",
             "zaixs": "扭矩(N·m)",
@@ -290,7 +290,7 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
                 "zData":dataFrame[Field_GeneratorTorque].tolist(),
                 "color": dataFrame[Field_YearMonth].tolist(),
                 "mode":'markers'
-            
+
         }]
         }
         # 保存图像
@@ -432,11 +432,11 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
         engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
         if isinstance(engineTypeName, pd.Series):
             engineTypeName = engineTypeName.iloc[0]
-        # 构建最终的JSON对象   
+        # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "发电机转速和转矩分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "发电机转速(r/min)",
             "yaixs": "机组",
             "zaixs": "实际扭矩(N·m)",
@@ -447,7 +447,7 @@ class GeneratorSpeedTorqueAnalyst(AnalystWithGoodPoint):
                 "zData":dataFrame[Field_GeneratorTorque].tolist(),
                 "color": dataFrame[Field_NameOfTurbine].tolist(),
                 "mode":'markers'
-            
+
         }]
         }
         # # 保存图像

+ 17 - 17
dataAnalysisBusiness/algorithm/minPitchAnalyst.py

@@ -94,7 +94,7 @@ class MinPitchAnalyst(AnalystWithGoodBadPoint):
             # df[pitchAngleRate] = df['count'] / df['total_count'] * 100
             # df[pitchAngleRate] = (df['count'] / df['total_count']).apply(lambda x: x ** 0.5)*100
             df[pitchAngleRate] = (df['count'] / df['total_count']) * 100
-            
+
             # Plotting using plotly
             fig = px.scatter(df,
                              x=Field_YearMonthDay,
@@ -134,15 +134,15 @@ class MinPitchAnalyst(AnalystWithGoodBadPoint):
             engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
             if isinstance(engineTypeCode, pd.Series):
                 engineTypeCode = engineTypeCode.iloc[0]
-    
+
             engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
             if isinstance(engineTypeName, pd.Series):
                 engineTypeName = engineTypeName.iloc[0]
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "最小桨距角分析",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "时间",
                 "yaixs": "桨距角(°)",
                 "data": [{
@@ -153,13 +153,13 @@ class MinPitchAnalyst(AnalystWithGoodBadPoint):
                     "yData": df[fieldPitchAngleBin].tolist(),
                     "colorbar": df[pitchAngleRate].tolist(),
                     "colorbartitle": "百分比(%)"
-                
+
             }]
             }
-            
+
             # Save plot
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
@@ -179,14 +179,14 @@ class MinPitchAnalyst(AnalystWithGoodBadPoint):
                 Field_Return_IsSaveDatabase: True
             })
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -196,7 +196,7 @@ class MinPitchAnalyst(AnalystWithGoodBadPoint):
             #     Field_Return_FilePath: filePathOfHtml,
             #     Field_Return_IsSaveDatabase: True
             # })
-       
+
         result_df = pd.DataFrame(result_rows)
 
         return result_df

+ 11 - 11
dataAnalysisBusiness/algorithm/pitchGeneratorSpeedAnalyst.py

@@ -110,7 +110,7 @@ class PitchGeneratorSpeedAnalyst(AnalystWithGoodBadPoint):
             engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
             if isinstance(engineTypeName, pd.Series):
                 engineTypeName = engineTypeName.iloc[0]
-            
+
             # 使用 apply() 对每个元素调用 datetime.fromtimestamp
             group[Field_UnixYearMonth] = group[Field_UnixYearMonth].apply(lambda x: datetime.fromtimestamp(x).strftime('%Y-%m'))
 
@@ -132,8 +132,8 @@ class PitchGeneratorSpeedAnalyst(AnalystWithGoodBadPoint):
                 }]
             }
             # Save plot
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
@@ -143,14 +143,14 @@ class PitchGeneratorSpeedAnalyst(AnalystWithGoodBadPoint):
                 import json
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             result_rows.append({
                 Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 24 - 24
dataAnalysisBusiness/algorithm/pitchPowerAnalyst.py

@@ -155,8 +155,8 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
             }
 
             # 保存图像
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, width=800, height=600, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, width=800, height=600, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
@@ -166,14 +166,14 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
                 import json
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-            result_rows1.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows1.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             result_rows1.append({
                 Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -254,7 +254,7 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
                 )
         '''
         # 假设 colorsList 已经在代码的其他部分定义
-        colorsList = [  
+        colorsList = [
             "#3E409C",
             "#3586BF",
             "#52A3AE",
@@ -268,7 +268,7 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
             "#E4574C",
             "#AF254F"
         ]
-        
+
         # 遍历每个设备的数据
         result_rows2 = []
         for name, group in grouped:
@@ -286,10 +286,10 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
                         Field_ActiverPower: '功率'
                     },
                 )
-        
+
                 # 设置固定散点大小
                 fig.update_traces(marker=dict(size=1.5))
-        
+
                 # 更新图形的布局
                 fig.update_layout(
                     title={
@@ -353,8 +353,8 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
                     }]
                 }
                 # 保存图像
-                filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}_3D.png")
-                fig.write_image(filePathOfImage, width=800, height=600, scale=3)
+                # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}_3D.png")
+                # fig.write_image(filePathOfImage, width=800, height=600, scale=3)
                 # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}_3D.html")
                 # fig.write_html(filePathOfHtml)
 
@@ -364,14 +364,14 @@ class PitchPowerAnalyst(AnalystWithGoodBadPoint):
                     import json
                     json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-                result_rows2.append({
-                    Field_Return_TypeAnalyst: self.typeAnalyst(),
-                    Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                    Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                    Field_CodeOfTurbine: name[1],
-                    Field_Return_FilePath: filePathOfImage,
-                    Field_Return_IsSaveDatabase: False
-                })
+                # result_rows2.append({
+                #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+                #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+                #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+                #     Field_CodeOfTurbine: name[1],
+                #     Field_Return_FilePath: filePathOfImage,
+                #     Field_Return_IsSaveDatabase: False
+                # })
                 result_rows2.append({
                     Field_Return_TypeAnalyst: self.typeAnalyst(),
                     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,

+ 14 - 14
dataAnalysisBusiness/algorithm/pitchTSRCpAnalyst.py

@@ -101,8 +101,8 @@ class PitchTSRCpAnalyst(AnalystWithGoodPoint):
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "变桨和叶尖速比及风能利用系数分析",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "叶尖速比",
                 "yaixs": "风能利用系数",
                 "data": [{
@@ -115,11 +115,11 @@ class PitchTSRCpAnalyst(AnalystWithGoodPoint):
                         "colorbartitle": "桨距角"
                         }]
             }
-            
-            
+
+
             # 保存html
-            filePathOfPng = os.path.join(outputAnalysisDir, f"{turbine_name}.png")
-            fig.write_image(filePathOfPng)
+            # filePathOfPng = os.path.join(outputAnalysisDir, f"{turbine_name}.png")
+            # fig.write_image(filePathOfPng)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{turbine_name}.html")
             # fig.write_html(filePathOfHtml)
 
@@ -139,14 +139,14 @@ class PitchTSRCpAnalyst(AnalystWithGoodPoint):
                 Field_Return_FilePath: output_json_path,
                 Field_Return_IsSaveDatabase: True
             })
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: turbine_code,
-                Field_Return_FilePath: filePathOfPng,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: turbine_code,
+            #     Field_Return_FilePath: filePathOfPng,
+            #     Field_Return_IsSaveDatabase: False
+            # })
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
             #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,

+ 11 - 11
dataAnalysisBusiness/algorithm/powerCurveAnalyst.py

@@ -350,9 +350,9 @@ class PowerCurveAnalyst(AnalystWithGoodPoint):
         )
 
         # 保存图像
-        pngFileName = f"{turbineName[0]}.png"
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig.write_image(pngFilePath, scale=3)
+        # pngFileName = f"{turbineName[0]}.png"
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig.write_image(pngFilePath, scale=3)
 
         # # 保存HTML
         # htmlFileName = f"{turbineName[0]}.html"
@@ -360,14 +360,14 @@ class PowerCurveAnalyst(AnalystWithGoodPoint):
         # fig.write_html(htmlFilePath)
 
         result_rows = []
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: turbineName[1],
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: turbineName[1],
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # result_rows.append({
         #     Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 18 - 18
dataAnalysisBusiness/algorithm/powerScatter2DAnalyst.py

@@ -60,7 +60,7 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
         #     cut_in_ws = dataFrame[Field_CutInWS].min() - 1
         # else:
         #     cut_in_ws = 2
-        
+
         # 按设备名分组数据
         grouped = dataFrame.groupby([Field_NameOfTurbine, Field_CodeOfTurbine])
         result_rows = []
@@ -183,7 +183,7 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
             engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
             if isinstance(engineTypeCode, pd.Series):
                 engineTypeCode = engineTypeCode.iloc[0]
-    
+
             engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
             if isinstance(engineTypeName, pd.Series):
                 engineTypeName = engineTypeName.iloc[0]
@@ -194,8 +194,8 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "逐月有功功率散点2D分析",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "风速(m/s)",
                 "yaixs": "有功功率(kW)",
                 "data": [
@@ -210,7 +210,7 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
                     "colorbar": group['monthIntTime'].tolist(),
                     "colorbartitle": "年月",
                     "mode":"markers"
-                
+
                     },
                     {# 提取合同功率曲线数据
                         "enginName": "合同功率曲线",
@@ -220,11 +220,11 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
                         "mode":"lines+markers"
                     }]
             }
-            
+
             # 保存图像
-            pngFileName = f"{name[0]}-scatter.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{name[0]}-scatter.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # # 保存HTML
             # htmlFileName = f"{name[0]}-scatter.html"
@@ -248,14 +248,14 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
                 Field_Return_IsSaveDatabase: True
             })
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -265,7 +265,7 @@ class PowerScatter2DAnalyst(AnalystWithGoodBadPoint):
             #     Field_Return_FilePath: htmlFilePath,
             #     Field_Return_IsSaveDatabase: True
             # })
-       
+
 
         result_df = pd.DataFrame(result_rows)
         return result_df

+ 29 - 29
dataAnalysisBusiness/algorithm/ratedPowerWindSpeedAnalyst.py

@@ -91,25 +91,25 @@ class RatedPowerWindSpeedAnalyst(AnalystWithGoodBadPoint):
         # 构建最终的JSON对象
         json_output = {
             "analysisTypeCode": "额定功率和风速分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "机组",
             "yaixs": "功率(kW)",
             "data": [{
                     "title":f'额定功率分布(环境温度>=25摄氏度)',
                     "xData": over_temp[Field_NameOfTurbine].tolist(),
                     "yData": over_temp[Field_ActiverPower].tolist(),
-                    "linecolor":'black', 
+                    "linecolor":'black',
                     "linewidth":1,
                     "fillcolor":'dodgerblue'
                     }]
         }
         result_rows = []
         # 保存图像
-        pngFileName = "额定满发风速功率分布(10min)(环境温度大于25度).png"
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig.write_image(pngFilePath, scale=3)
-       
+        # pngFileName = "额定满发风速功率分布(10min)(环境温度大于25度).png"
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig.write_image(pngFilePath, scale=3)
+
         # # 保存HTML
         # htmlFileName = "额定满发风速功率分布(10min)(环境温度大于25度).html"
         # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
@@ -130,14 +130,14 @@ class RatedPowerWindSpeedAnalyst(AnalystWithGoodBadPoint):
             Field_Return_FilePath: output_json_path,
             Field_Return_IsSaveDatabase: True
         })
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: 'total',
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: 'total',
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # result_rows.append({
         #     Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -183,23 +183,23 @@ class RatedPowerWindSpeedAnalyst(AnalystWithGoodBadPoint):
         # 构建最终的JSON对象2
         json_output2 = {
             "analysisTypeCode": "额定功率和风速分析",
-            "engineCode":  engineTypeCode,    
-            "engineTypeName": engineTypeName, 
+            "engineCode":  engineTypeCode,
+            "engineTypeName": engineTypeName,
             "xaixs": "机组",
             "yaixs": "功率(kw)",
             "data": [{
                     "title":f'额定功率分布(环境温度<25摄氏度)',
                     "xData": below_temp[Field_NameOfTurbine].tolist(),
                     "yData": below_temp[Field_ActiverPower].tolist(),
-                    "linecolor":'black', 
+                    "linecolor":'black',
                     "linewidth":1,
                     "fillcolor":'dodgerblue'
                     }]
         }
         # 保存图像
-        pngFileName = "额定满发风速功率分布(10min)(环境温度小于25度).png"
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig.write_image(pngFilePath, scale=3)
+        # pngFileName = "额定满发风速功率分布(10min)(环境温度小于25度).png"
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig.write_image(pngFilePath, scale=3)
 
         # # 保存HTML
         # htmlFileName = "额定满发风速功率分布(10min)(环境温度小于25度).html"
@@ -221,14 +221,14 @@ class RatedPowerWindSpeedAnalyst(AnalystWithGoodBadPoint):
             Field_Return_FilePath: output_json_path2,
             Field_Return_IsSaveDatabase: True
         })
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: 'total',
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: 'total',
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # result_rows.append({
         #     Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 11 - 11
dataAnalysisBusiness/algorithm/ratedWindSpeedAnalyst.py

@@ -100,9 +100,9 @@ class RatedWindSpeedAnalyst(AnalystWithGoodBadPoint):
 
         result_rows = []
         # 保存图像
-        pngFileName = '风速区间数据计数.png'
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig.write_image(pngFilePath, scale=3)
+        # pngFileName = '风速区间数据计数.png'
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig.write_image(pngFilePath, scale=3)
 
         # 保存HTML
         # htmlFileName = '风速区间数据计数.html'
@@ -114,14 +114,14 @@ class RatedWindSpeedAnalyst(AnalystWithGoodBadPoint):
             import json
             json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: 'total',
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: 'total',
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         result_rows.append({
             Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 24 - 24
dataAnalysisBusiness/algorithm/temperatureEnvironmentAnalyst.py

@@ -159,10 +159,10 @@ class TemperatureEnvironmentAnalyst(AnalystWithGoodBadLimitPoint):
 
         result_rows = []
         # 保存图像
-        pngFileName = '{}环境温差Bias.png'.format(
-            self.powerFarmInfo[Field_PowerFarmName].iloc[0])
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig1.write_image(pngFilePath, scale=3)
+        # pngFileName = '{}环境温差Bias.png'.format(
+        #     self.powerFarmInfo[Field_PowerFarmName].iloc[0])
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig1.write_image(pngFilePath, scale=3)
 
         # 保存HTML
         # htmlFileName = '{}环境温差Bias.html'.format(
@@ -187,14 +187,14 @@ class TemperatureEnvironmentAnalyst(AnalystWithGoodBadLimitPoint):
             Field_Return_IsSaveDatabase: True
         })
 
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: Const_Output_Total,
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: Const_Output_Total,
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # result_rows.append({
         #    Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -245,10 +245,10 @@ class TemperatureEnvironmentAnalyst(AnalystWithGoodBadLimitPoint):
 
 
         # 保存图像
-        pngFileName = '{}环境温度中位数.png'.format(
-            self.powerFarmInfo[Field_PowerFarmName].iloc[0])
-        pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-        fig2.write_image(pngFilePath, scale=3)
+        # pngFileName = '{}环境温度中位数.png'.format(
+        #     self.powerFarmInfo[Field_PowerFarmName].iloc[0])
+        # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+        # fig2.write_image(pngFilePath, scale=3)
 
         # 保存HTML
         # htmlFileName = '{}环境温度中位数.html'.format(
@@ -273,14 +273,14 @@ class TemperatureEnvironmentAnalyst(AnalystWithGoodBadLimitPoint):
             Field_Return_IsSaveDatabase: True
         })
 
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: Const_Output_Total,
-            Field_Return_FilePath: pngFilePath,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: Const_Output_Total,
+        #     Field_Return_FilePath: pngFilePath,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # result_rows.append({
         #    Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 31 - 31
dataAnalysisBusiness/algorithm/temperatureLargeComponentsAnalyst.py

@@ -202,8 +202,8 @@ class TemperatureLargeComponentsAnalyst(AnalystWithGoodBadLimitPoint):
             )
 
             # Save the plot as a PNG/HTML file
-            filePathOfImage = os.path.join(outputPath, f"{columnZH}-{turbineModelInfo[Field_MillTypeCode]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputPath, f"{columnZH}-{turbineModelInfo[Field_MillTypeCode]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputPath, f"{columnZH}-{turbineModelInfo[Field_MillTypeCode]}.html")
             #fig.write_html(filePathOfHtml)
 
@@ -232,14 +232,14 @@ class TemperatureLargeComponentsAnalyst(AnalystWithGoodBadLimitPoint):
                 import json
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: Const_Output_Total,
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: Const_Output_Total,
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #    Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -353,21 +353,21 @@ class TemperatureLargeComponentsAnalyst(AnalystWithGoodBadLimitPoint):
                     import json
                     json.dump(json_output, f, ensure_ascii=False, indent=4)
 
-                filePathOfImage = os.path.join(
-                    outputPath, f"{currTurbineInfo_each[Field_NameOfTurbine]}.png")
-                single_fig.write_image(filePathOfImage, scale=3)
+                # filePathOfImage = os.path.join(
+                #     outputPath, f"{currTurbineInfo_each[Field_NameOfTurbine]}.png")
+                # single_fig.write_image(filePathOfImage, scale=3)
                 # filePathOfHtml = os.path.join(
                 #     outputPath, f"{name}.html")
                 # single_fig.write_html(filePathOfHtml)
 
-                result_rows.append({
-                    Field_Return_TypeAnalyst: self.typeAnalyst(),
-                    Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                    Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                    Field_CodeOfTurbine: group[Field_CodeOfTurbine].iloc[0],
-                    Field_Return_FilePath: filePathOfImage,
-                    Field_Return_IsSaveDatabase: False
-                })
+                # result_rows.append({
+                #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+                #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+                #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+                #     Field_CodeOfTurbine: group[Field_CodeOfTurbine].iloc[0],
+                #     Field_Return_FilePath: filePathOfImage,
+                #     Field_Return_IsSaveDatabase: False
+                # })
 
                 # 如果需要返回DataFrame,可以包含文件路径
                 result_rows.append({
@@ -527,20 +527,20 @@ class TemperatureLargeComponentsAnalyst(AnalystWithGoodBadLimitPoint):
             import json
             json.dump(json_output, f, ensure_ascii=False, indent=4)
         # Save the plot as a PNG/HTML file
-        filePathOfImage = os.path.join(outputDir, f"{turbineName}.png")
-        fig.write_image(filePathOfImage,  width=800, height=600, scale=3)
+        # filePathOfImage = os.path.join(outputDir, f"{turbineName}.png")
+        # fig.write_image(filePathOfImage,  width=800, height=600, scale=3)
         # filePathOfHtml = os.path.join(outputDir, f"{turbineName}.html")
         # fig.write_html(filePathOfHtml)
 
         result_rows1 = []
-        result_rows1.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
-            Field_Return_FilePath: filePathOfImage,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows1.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: dataFrame[Field_CodeOfTurbine].iloc[0],
+        #     Field_Return_FilePath: filePathOfImage,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         # 如果需要返回DataFrame,可以包含文件路径
         result_rows1.append({

+ 11 - 11
dataAnalysisBusiness/algorithm/tsrAnalyst.py

@@ -316,23 +316,23 @@ class TSRAnalyst(AnalystWithGoodPoint):
 
 
             # 保存图像
-            pngFileName = f"{name[0]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{name[0]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # 保存HTML
             # htmlFileName = f"{name[0]}.html"
             # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
             # fig.write_html(htmlFilePath)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # 将JSON对象保存到文件
             output_json_path_each = os.path.join(outputAnalysisDir, f"{name[0]}.json")

+ 11 - 11
dataAnalysisBusiness/algorithm/tsrCpPowerAnalyst.py

@@ -307,9 +307,9 @@ class TSRCpPowerAnalyst(AnalystWithGoodPoint):
             fig.update_xaxes(tickangle=-45)
 
             # 保存图像
-            pngFileName = f"{name[0]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{name[0]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
 
             engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
@@ -337,14 +337,14 @@ class TSRCpPowerAnalyst(AnalystWithGoodPoint):
             # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
             #fig.write_html(htmlFilePath)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # 将JSON对象保存到文件
             output_json_path_each = os.path.join(outputAnalysisDir, f"{name[0]}.json")

+ 11 - 11
dataAnalysisBusiness/algorithm/tsrCpPowerScatterAnalyst.py

@@ -108,9 +108,9 @@ class TSRCpPowerScatterAnalyst(AnalystWithGoodPoint):
             }
 
             # 保存图像
-            pngFileName = f"{name[0]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{name[0]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # 将JSON对象保存到文件
             output_json_path = os.path.join(outputAnalysisDir, f"{name[0]}.json")
@@ -134,14 +134,14 @@ class TSRCpPowerScatterAnalyst(AnalystWithGoodPoint):
             })
 
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 15 - 15
dataAnalysisBusiness/algorithm/tsrTrendAnalyst.py

@@ -113,8 +113,8 @@ class TSRTrendAnalyst(AnalystWithGoodPoint):
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "叶尖速比时序分析",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "时间",
                 "yaixs": "叶尖速比",
                 "data": [{
@@ -130,15 +130,15 @@ class TSRTrendAnalyst(AnalystWithGoodPoint):
                                 "x": medians.index.tolist(),  # 中位数的 x 轴数据
                                 "y": medians.values.tolist(),  # 中位数的 y 轴数据
                                 "mode":'markers',
-                                "color":'orange', 
+                                "color":'orange',
                                 "size":3
                                 }
-                        }] 
+                        }]
             }
-            
+
             # 保存图像
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml  = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
             # 将JSON对象保存到文件
@@ -157,14 +157,14 @@ class TSRTrendAnalyst(AnalystWithGoodPoint):
                 Field_Return_IsSaveDatabase: True
             })
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 11 - 11
dataAnalysisBusiness/algorithm/tsrWindSpeedAnalyst.py

@@ -348,23 +348,23 @@ class TSRWindSpeedAnalyst(AnalystWithGoodPoint):
             })
 
             # 保存图像
-            pngFileName = f"{name[0]}.png"
-            pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
-            fig.write_image(pngFilePath, scale=3)
+            # pngFileName = f"{name[0]}.png"
+            # pngFilePath = os.path.join(outputAnalysisDir, pngFileName)
+            # fig.write_image(pngFilePath, scale=3)
 
             # 保存HTML
             # htmlFileName = f"{name[0]}.html"
             # htmlFilePath = os.path.join(outputAnalysisDir, htmlFileName)
             # fig.write_html(htmlFilePath)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: pngFilePath,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: pngFilePath,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #    Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 17 - 17
dataAnalysisBusiness/algorithm/windDirectionFrequencyAnalyst.py

@@ -34,7 +34,7 @@ class WindDirectionFrequencyAnalyst(AnalystNotFilter):
         dataFrameMerge = self.userDataFrame(dictionary, conf.dataContract.configAnalysis, self)
         results=self.windRoseAnalysis(dataFrameMerge, outputAnalysisDir, conf)
         returnJsonData = self.outputJsonData(conf, outputAnalysisDir, turbineInfos, dataFrameMerge)
-    
+
         returnDatas=pd.concat([results,returnJsonData], axis=0, ignore_index=True)
         return returnDatas
     '''
@@ -225,23 +225,23 @@ class WindDirectionFrequencyAnalyst(AnalystNotFilter):
             )
 
             # 保存图像
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml  = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID, 
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
-            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID, 
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
             #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
             #     Field_CodeOfTurbine: name[1],
             #     Field_Return_FilePath: filePathOfHtml,
@@ -252,10 +252,10 @@ class WindDirectionFrequencyAnalyst(AnalystNotFilter):
 
         # 返回结果数据框
         return result_df
-    
+
     def outputJsonData(self, conf: Contract, outputAnalysisDir: str, turbineModelInfo: pd.Series, dataFrameMerge: pd.DataFrame) -> pd.DataFrame:
         turbineCodes = dataFrameMerge[Field_CodeOfTurbine].unique()
-        
+
         result_rows = []
         for turbineCode in turbineCodes:
             jsonDictionary = self.convert2Json(turbineModelInfo, turbineCodes=turbineCode, dataFrameOfTurbines=dataFrameMerge)
@@ -270,13 +270,13 @@ class WindDirectionFrequencyAnalyst(AnalystNotFilter):
                 Field_Return_FilePath: jsonFilePath,
                 Field_Return_IsSaveDatabase: True
             })
-    
+
         returnDatas = pd.DataFrame(result_rows)
         return returnDatas
 
     def outputJsonData(self, conf: Contract, outputAnalysisDir: str, turbineModelInfo: pd.Series, dataFrameMerge: pd.DataFrame) -> pd.DataFrame:
         turbineCodes = dataFrameMerge[Field_CodeOfTurbine].unique()
-        
+
         result_rows = []
         for turbineCode in turbineCodes:
             if turbineCode in self.frequency_data:
@@ -296,7 +296,7 @@ class WindDirectionFrequencyAnalyst(AnalystNotFilter):
                 Field_Return_FilePath: jsonFilePath,
                 Field_Return_IsSaveDatabase: True
             })
-    
+
         returnDatas = pd.DataFrame(result_rows)
         return returnDatas
 

+ 11 - 11
dataAnalysisBusiness/algorithm/windSpeedAnalyst.py

@@ -69,9 +69,9 @@ class WindSpeedAnalyst(AnalystNotFilter):
         }
 
         # Save plot
-        filePathOfImage = os.path.join(
-            outputAnalysisDir, f"WindSpeedAvg_Turbines.png")
-        fig.write_image(filePathOfImage, scale=3)
+        # filePathOfImage = os.path.join(
+        #     outputAnalysisDir, f"WindSpeedAvg_Turbines.png")
+        # fig.write_image(filePathOfImage, scale=3)
         # filePathOfHtml = os.path.join(
             # outputAnalysisDir, f"WindSpeedAvg_Turbines.html")
         # fig.write_html(filePathOfHtml)
@@ -83,14 +83,14 @@ class WindSpeedAnalyst(AnalystNotFilter):
             json.dump(json_output, f, ensure_ascii=False, indent=4)
 
         result_rows = []
-        result_rows.append({
-            Field_Return_TypeAnalyst: self.typeAnalyst(),
-            Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-            Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-            Field_CodeOfTurbine: "total",
-            Field_Return_FilePath: filePathOfImage,
-            Field_Return_IsSaveDatabase: False
-        })
+        # result_rows.append({
+        #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+        #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+        #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+        #     Field_CodeOfTurbine: "total",
+        #     Field_Return_FilePath: filePathOfImage,
+        #     Field_Return_IsSaveDatabase: False
+        # })
 
         result_rows.append({
             Field_Return_TypeAnalyst: self.typeAnalyst(),

+ 16 - 16
dataAnalysisBusiness/algorithm/windSpeedFrequencyAnalyst.py

@@ -14,8 +14,8 @@ class WindSpeedFrequencyAnalyst(AnalystNotFilter):
 
     def typeAnalyst(self):
         return "wind_speed_frequency"
-    
-    # def filterCommon(self,dataFrame:pd.DataFrame, conf: Contract):        
+
+    # def filterCommon(self,dataFrame:pd.DataFrame, conf: Contract):
     #     return dataFrame
 
     def turbinesAnalysis(self, outputAnalysisDir, conf: Contract, turbineCodes):
@@ -41,7 +41,7 @@ class WindSpeedFrequencyAnalyst(AnalystNotFilter):
             # 2. 计算风速频率
             # 首先,我们需要确定风速的范围并计算每个风速的频数
             # wind_speeds = group[Field_WindSpeed].unique()
-            # 计算风速频率,确保频率没有零值(用很小的数代替零)  
+            # 计算风速频率,确保频率没有零值(用很小的数代替零)
             wind_speed_freq = np.histogram(group[Field_WindSpeed], bins=wind_speed_bins)[0]
             wind_speed_freq = np.maximum(wind_speed_freq, 0.01) / len(group[Field_WindSpeed]) * 100
             wind_speed_freq1 = np.where(wind_speed_freq < 0.0001, 0, wind_speed_freq)
@@ -108,8 +108,8 @@ class WindSpeedFrequencyAnalyst(AnalystNotFilter):
             }
 
             # Save plot
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
@@ -118,19 +118,19 @@ class WindSpeedFrequencyAnalyst(AnalystNotFilter):
             with open(output_json_path, 'w', encoding='utf-8') as f:
                 import json
                 json.dump(json_output, f, ensure_ascii=False, indent=4)
-            
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID, 
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             result_rows.append({
                 Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID, 
+                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
                 Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
                 Field_CodeOfTurbine: name[1],
                 Field_MillTypeCode: 'total',
@@ -141,4 +141,4 @@ class WindSpeedFrequencyAnalyst(AnalystNotFilter):
         result_df = pd.DataFrame(result_rows)
 
         return result_df
-     
+

+ 24 - 24
dataAnalysisBusiness/algorithm/yawErrorAnalyst.py

@@ -22,7 +22,7 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
     fieldPowerMedian = 'median_power'
     fieldYawError = 'yaw_error'
     fieldStep = 'wsstep'
-    fieldK = 'k' 
+    fieldK = 'k'
     fieldWindSpeed = 'mean_WindSpeed'
     fieldcount = 'point_num'
 
@@ -66,7 +66,7 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
         return dataFrame
 
     def calculateYawError(self, dataFrame: pd.DataFrame, fieldAngleInclude,fieldActivePower, fieldWindSpeed):
-        
+
         dataFrame = dataFrame.dropna(
             subset=[Field_NameOfTurbine, fieldAngleInclude, fieldActivePower,fieldWindSpeed])
         df_math_yaw = dataFrame.copy()
@@ -137,19 +137,19 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
         required_columns = {Field_ActiverPower, Field_YawError,Field_WindSpeed,Field_PitchAngel1,Field_Cp,Field_TSR}
         if not required_columns.issubset(dataFrameMerge.columns):
             raise ValueError(f"DataFrame缺少必要的列。需要的列有: {required_columns}")
-        
+
         results = []
         result_rows = []
         grouped = dataFrameMerge.groupby(
             [Field_NameOfTurbine, Field_CodeOfTurbine])
- 
+
         for name, group in grouped:
             group = self.filterCommon(group,conf)
             df,final_df = self.calculateYawError(
                 group, Field_YawError, Field_ActiverPower,Field_WindSpeed)
-            
+
             df.dropna(inplace=True)
-            
+
             # final_df.dropna(inplace=True)
             """
             自动化选择tsr平稳段的风速段作为风速最后的筛选区间
@@ -201,7 +201,7 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
                     # print(f"风速平稳段的最小值: {min_windspeed}")
                 else:
                     print("未找到平稳段")
-             """      
+             """
             # 筛选出 self.fieldWindSpeed 列的数值处于 4.5 到 8 区间内的行
             filtered_df = df[(df[self.fieldWindSpeed] >= 4.5) & (df[self.fieldWindSpeed] <= 8)]
             # 查找 df 中  self.fieldYawError列的平均值,并向下取整作为偏航误差
@@ -224,7 +224,7 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
                     mode='lines+markers',
                     name=col
                 ))
-            
+
             fig.update_layout(
                 title=f'偏航误差分析 {name[0]} ',
                 xaxis_title='偏航角度',
@@ -246,8 +246,8 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
             # 构建最终的JSON对象
             json_output = {
                     "analysisTypeCode": "偏航误差分析",
-                    "engineCode": engineTypeCode,    
-                    "engineTypeName": engineTypeName, 
+                    "engineCode": engineTypeCode,
+                    "engineTypeName": engineTypeName,
                     "xaixs": "偏航角度(°)",
                     "yaixs": "有功功率(kw)",
                     "data": [
@@ -259,15 +259,15 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
                             "yData": yData.tolist(),
                             "legend": col,
                             "type": "lines+markers",
-                            
+
                         }
                         for col in final_df.columns[1:]  # 跳过第一列 self.fieldWindDirFloor
                     ]
                     }
-            
+
             # Save to file
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
             # 将JSON对象保存到文件
@@ -286,14 +286,14 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
                 Field_Return_IsSaveDatabase: True
             })
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -302,8 +302,8 @@ class YawErrorAnalyst(AnalystWithGoodPoint):
             #     Field_CodeOfTurbine: name[1],
             #     Field_Return_FilePath: filePathOfHtml,
             #     Field_Return_IsSaveDatabase: True
-            
-            
+
+
             # })
             # # 初始化一个空的DataFrame,指定列名
             # columns = [Field_NameOfTurbine, Field_YawError]

+ 32 - 32
dataAnalysisBusiness/algorithm/yawErrorDensityAnalyst.py

@@ -66,11 +66,11 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
         fixed_colorscale = [
             [i / (len(fixed_colors) - 1), color] for i, color in enumerate(fixed_colors)
         ]
-        
+
         for name, group in grouped:
             dataFrame=group[Field_YawError].abs() <= 45
-            yawerror=np.mean(dataFrame[Field_YawError])
-            
+            # yawerror=np.mean(dataFrame[Field_YawError])
+
             df = self.calculateYawError(group)
             df.dropna(inplace=True)
             counts = df['density'].value_counts()
@@ -92,7 +92,7 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
                 'std_X': [std_X],
                 'mediann_X':[mediann_X],
                 'skewness_X':[skewness_X],
-                'kurtosis_X':[kurtosis_X], 
+                'kurtosis_X':[kurtosis_X],
                 'max_X':[max_X],
                 'min_X':[min_X]
             }
@@ -103,19 +103,19 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
             fig.add_trace(go.Scattergl(
                 x=df["x"],
                 y=df["y"],
-                mode='markers', 
+                mode='markers',
                 marker=dict(
                     size=3,
-                    opacity=0.7, 
-                    color=df["density"], 
-                    colorscale=fixed_colorscale, 
+                    opacity=0.7,
+                    color=df["density"],
+                    colorscale=fixed_colorscale,
                     showscale=True,
                 )
             ))
 
             fig.update_layout(
                 xaxis_title='对风角度',
-                yaxis_title='风速', 
+                yaxis_title='风速',
                 title=f'动态偏航误差分析-{name[0]}',
                 xaxis=dict(range=[-20, 20]),  # 限制横坐标范围为 -20 到 20
                 yaxis=dict(range=[0, 25])
@@ -132,8 +132,8 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
             # 构建最终的JSON对象
             json_output = {
                 "analysisTypeCode": "动态偏航误差",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "对风角度(°)",
                 "yaixs": "风速(m/s)",
                 "data": [{
@@ -144,7 +144,7 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
                 "yData": df["y"].tolist(),
                 "colorbar": df["density"].tolist(),
                 "colorbartitle": "密度"
-                
+
             }]
             }
 
@@ -156,8 +156,8 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
             # 构建最终的JSON对象2
             json_output2 = {
                 "analysisTypeCode": "动态偏航误差",
-                "engineCode":  engineTypeCode,    
-                "engineTypeName": engineTypeName, 
+                "engineCode":  engineTypeCode,
+                "engineTypeName": engineTypeName,
                 "xaixs": "对风角度(°)",
                 "yaixs": "概率密度函数",
                 "data": [{
@@ -167,18 +167,18 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
                 "xData": x .tolist(),
                 "yData": pdf_data.tolist(),
                 "xrange":[-30,30]
-                
+
             }]
             }
-        
+
             # Save to file
-            filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
-            fig.write_image(filePathOfImage, scale=3)
+            # filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
+            # fig.write_image(filePathOfImage, scale=3)
             # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
             # fig.write_html(filePathOfHtml)
 
 
-            # 将JSON对象保存到文件
+            # 将JSON对象保存到文件np.mean(dataFrame[Field_YawError])
             output_json_path = os.path.join(outputAnalysisDir, f"{name[0]}.json")
             with open(output_json_path, 'w', encoding='utf-8') as f:
                 import json
@@ -208,14 +208,14 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
                 Field_Return_IsSaveDatabase: True
             })
 
-            result_rows.append({
-                Field_Return_TypeAnalyst: self.typeAnalyst(),
-                Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
-                Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
-                Field_CodeOfTurbine: name[1],
-                Field_Return_FilePath: filePathOfImage,
-                Field_Return_IsSaveDatabase: False
-            })
+            # result_rows.append({
+            #     Field_Return_TypeAnalyst: self.typeAnalyst(),
+            #     Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
+            #     Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
+            #     Field_CodeOfTurbine: name[1],
+            #     Field_Return_FilePath: filePathOfImage,
+            #     Field_Return_IsSaveDatabase: False
+            # })
 
             # result_rows.append({
             #     Field_Return_TypeAnalyst: self.typeAnalyst(),
@@ -224,16 +224,16 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
             #     Field_CodeOfTurbine: name[1],
             #     Field_Return_FilePath: filePathOfHtml,
             #     Field_Return_IsSaveDatabase: True
-            
-            
+
+
             # })
 
         result_df = pd.DataFrame(result_rows)
 
         return result_df
-    
+
     def calculateYawError(self, dataFrame: pd.DataFrame):
-        
+
         dataFrame = dataFrame.dropna(
             subset=[Field_NameOfTurbine, Field_YawError, Field_ActiverPower,Field_WindSpeed])
 
@@ -265,5 +265,5 @@ class YawErrorDensityAnalyst(AnalystWithGoodBadLimitPoint):
 
         # 将 result 转换为 DataFrame
         result_df = pd.DataFrame(result)
-        
+
         return result_df

+ 1 - 1
dataAnalysisBusiness/setup.py

@@ -40,7 +40,7 @@ class InstallCommand(install):
 
 setup(
     name='dataAnalysisBusiness',
-    version='1.2.202501161710',
+    version='1.2.202505141510',
     description='Data Analysis Business Package', # 描述信息
     author='Xie Zhou Yang', # 作者
     packages=find_packages(),

+ 8 - 8
dataAnalysisService/setup.py

@@ -10,12 +10,12 @@ from pathlib import Path
 compileDirs=['service']
 
 class CustomBuildPy(build_py):
-    def run(self):        
+    def run(self):
         # 获取当前 Python 版本信息
         py_version = f".cpython-{sys.version_info.major}{sys.version_info.minor}"
 
         for dir in compileDirs:
-            for root,_,subFiles in os.walk(dir):                
+            for root,_,subFiles in os.walk(dir):
                 compileall.compile_dir(root, force=True)
 
                 for file in subFiles:
@@ -24,23 +24,23 @@ class CustomBuildPy(build_py):
                         new_File = file.replace(py_version, '')
                         new_path=os.path.join(Path(root).parent,new_File)
                         shutil.move(pyc_path, new_path)
-                        
+
         super().run()
 
 class InstallCommand(install):
     def run(self):
         super().run()
-        # Remove all .py files from the installed package    
-        # 若用于开发,可查看导入的自定义package 则注释本代码段 
+        # Remove all .py files from the installed package
+        # 若用于开发,可查看导入的自定义package 则注释本代码段
         # 若用于部署交付,可应用本代码
         # for root, _, files in os.walk(self.install_lib):
-        #     for file in files:                
+        #     for file in files:
         #         if file.endswith('.py'):
         #             os.remove(os.path.join(root, file))
-        
+
 setup(
     name='dataAnalysisService',
-    version='1.2.202405111336',
+    version='1.2.202505131440',
     description='Data Analysis Service Package',  # 描述信息
     author='Xie Zhou Yang',  # 作者
     packages=find_packages(),

+ 1 - 1
dataContract/setup.py

@@ -40,7 +40,7 @@ class InstallCommand(install):
 
 setup(
     name='dataContract',
-    version='1.2.202501161028',
+    version='1.2.202505131440',
     description='Data Contract Package', # 描述信息
     author='Xie Zhou Yang', # 作者
     packages=find_packages(),

+ 1 - 1
repositoryZN/setup.py

@@ -40,7 +40,7 @@ class InstallCommand(install):
 
 setup(
     name='repositoryZN',
-    version='1.2.202501161028',
+    version='1.2.202505131440',
     description='Repository Package', # 描述信息
     author='Xie Zhou Yang', # 作者
     packages=find_packages(),