This commit is contained in:
2022-05-09 06:59:23 +08:00
commit e16e7dbf7a
20 changed files with 5855 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/python_project.iml" filepath="$PROJECT_DIR$/.idea/python_project.iml" />
</modules>
</component>
</project>

8
.idea/python_project.iml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

2815
1.csv Normal file

File diff suppressed because one or more lines are too long

2815
1_disturb.csv Normal file

File diff suppressed because one or more lines are too long

15
algorithm.py Normal file
View File

@@ -0,0 +1,15 @@
from abc import ABC, abstractmethod
class algorithm(ABC):
@abstractmethod
def set_config(self, config):
pass
@abstractmethod
def config(self):
pass
@abstractmethod
def eval(self, value):
pass

BIN
algorithm_py(1).zip Normal file

Binary file not shown.

25
cycle.py Normal file
View File

@@ -0,0 +1,25 @@
from algorithm import algorithm
import json
import math
class cycle(algorithm):
def __init__(self):
self.config_dict_ = None
self.config_ = None
self.amplitude_base_ = 0.0
self.time_base_ = 10.0
self.start_angle_base_ = 0.0
def set_config(self, config):
self.config_ = config
self.config_dict_ = json.loads(self.config_)
self.amplitude_base_ = self.config_dict_["CYCLE_AMPLITUDE_BASE"]
self.time_base_ = self.config_dict_["CYCLE_TIME_BASE"]
self.start_angle_base_ = self.config_dict_["CYCLE_START_ANGLE_BASE"]
def config(self):
return self.config_
def eval(self, value, times):
return value + self.amplitude_base_ * math.sin((2 * math.pi * times / self.time_base_) + self.start_angle_base_)

20
cycle_test.py Normal file
View File

@@ -0,0 +1,20 @@
import pandas as pd
from cycle import cycle
filepath = "D:/python_project/TurbineExhaustTemperatureTheromcouple-FourWorkingCondition.xlsx"
origin_data = pd.read_excel(filepath,sheet_name='s4_ttxd')
row_len = origin_data.shape[0]
cow_len = origin_data.shape[1]
disturb_data = origin_data
algorithm_step = cycle()
cow_name = "ttxd_12_1"
algorithm_step.set_config('{"CYCLE_AMPLITUDE_BASE": 200 , "CYCLE_TIME_BASE": 5 ,"CYCLE_START_ANGLE_BASE": 3.14}')
# algorithm_step.set_config('{"CYCLE_TIME_BASE": 5 }')
for i in range(0,row_len):
disturb_data.loc[i,cow_name]=algorithm_step.eval(origin_data.loc[i,cow_name],i)
print(disturb_data)
# 以下均为测试性能用
print(algorithm_step.config_)

21
cycle_test_csv.py Normal file
View File

@@ -0,0 +1,21 @@
import pandas as pd
from cycle import cycle
filepath = "D:/python_project/1.csv"
origin_data = pd.read_csv(filepath)
row_len = origin_data.shape[0]
cow_len = origin_data.shape[1]
disturb_data = origin_data
algorithm_step = cycle()
cow_name = "G1.TTXD1_3"
algorithm_step.set_config('{"CYCLE_AMPLITUDE_BASE": 200 , "CYCLE_TIME_BASE": 5 ,"CYCLE_START_ANGLE_BASE": 3.14}')
# algorithm_step.set_config('{"CYCLE_TIME_BASE": 5 }')
for i in range(0,row_len):
disturb_data.loc[i,cow_name]=algorithm_step.eval(origin_data.loc[i,cow_name],i)
print(disturb_data)
disturb_data.to_csv("D:/python_project/1_disturb.csv", index=False)
# 以下均为测试性能用
print(algorithm_step.config_)

20
excursion.py Normal file
View File

@@ -0,0 +1,20 @@
from algorithm import algorithm
import json
class excursion(algorithm):
def __init__(self):
self.config_dict_ = None
self.config_ = None
self.amplitude_base_ = 0.0
def set_config(self, config):
self.config_ = config
self.config_dict_ = json.loads(self.config_)
self.amplitude_base_ = self.config_dict_["STEP_AMPLITUDE_BASE"]
def config(self):
return self.config_
def eval(self, value):
return value + self.amplitude_base_

13
main.py Normal file
View File

@@ -0,0 +1,13 @@
# 这是一个示例 Python 脚本。
# 按 Shift+F10 执行或将其替换为您的代码。
# 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。
from step import step
algorithm_step = step()
algorithm_step.set_config('{"STEP_AMPLITUDE_BASE": 1.3}')
for x in range(1, 101):
print("%d %f" % (x, algorithm_step.eval(x)))

20
step.py Normal file
View File

@@ -0,0 +1,20 @@
from algorithm import algorithm
import json
class step(algorithm):
def __init__(self):
self.config_dict_ = None
self.config_ = None
self.amplitude_base_ = 0.0
def set_config(self, config):
self.config_ = config
self.config_dict_ = json.loads(self.config_)
self.amplitude_base_ = self.config_dict_["STEP_AMPLITUDE_BASE"]
def config(self):
return self.config_
def eval(self, value):
return value * self.amplitude_base_

14
step_test.py Normal file
View File

@@ -0,0 +1,14 @@
import pandas as pd
from step import step
filepath = "D:/python_project/TurbineExhaustTemperatureTheromcouple-FourWorkingCondition.xlsx"
origin_data = pd.read_excel(filepath,sheet_name='s4_ttxd')
row_len = origin_data.shape[0]
cow_len = origin_data.shape[1]
disturb_data = origin_data
algorithm_step = step()
cow_name = "ttxd_12_1"
algorithm_step.set_config('{"STEP_AMPLITUDE_BASE": 1.3}')
for i in range(0,row_len):
disturb_data.loc[i,cow_name]=algorithm_step.eval(origin_data.loc[i,cow_name])
print(disturb_data)

22
white_noise.py Normal file
View File

@@ -0,0 +1,22 @@
from random import random
import numpy as np
from algorithm import algorithm
import json
class white_noise(algorithm):
def __init__(self):
self.config_dict_ = None
self.config_ = None
self.standard_deviation_base_ = 0.0
def set_config(self, config):
self.config_ = config
self.config_dict_ = json.loads(self.config_)
self.standard_deviation_base_ = self.config_dict_["WHITE_NOISE_STANDARD_DEVIATION_BASE"]
def config(self):
return self.config_
def eval(self, value):
return value + np.random.normal(loc=0.0, scale=self.standard_deviation_base_, size=None)

15
white_noise_test.py Normal file
View File

@@ -0,0 +1,15 @@
import pandas as pd
from white_noise import white_noise
filepath = "D:/python_project/TurbineExhaustTemperatureTheromcouple-FourWorkingCondition.xlsx"
origin_data = pd.read_excel(filepath,sheet_name='s4_ttxd')
row_len = origin_data.shape[0]
cow_len = origin_data.shape[1]
disturb_data = origin_data
algorithm_step = white_noise()
# cow_name = "ttxd_12_1"
algorithm_step.set_config('{"WHITE_NOISE_STANDARD_DEVIATION_BASE": 100}')
# for i in range(0,row_len):
# disturb_data.loc[i,cow_name]=algorithm_step.eval(origin_data.loc[i,cow_name])
# print(disturb_data)
print(algorithm_step.config_)