-
Notifications
You must be signed in to change notification settings - Fork 1
/
data_creation_running.py
121 lines (107 loc) · 4.46 KB
/
data_creation_running.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import numpy as np
import pandas as pd
from parameters import *
############################
### True Data Generation ###
############################
### Fermentation
def fermentation_creation():
treacle = np.random.normal(t_treacle,t_treacle_tol/8,time)
seeding = np.random.normal(t_seeding,t_seeding_tol/8,time)
water = np.random.normal(t_water,t_water_tol/8,time)
temperature = np.random.normal(T_1,T_1_tol/8,time)
pression = np.random.normal(p,p_tol/8,time)
pH_temp = np.random.normal(pH,pH_tol/8,time)
out = np.random.normal(pourcentage_output_1,pourcentage_output_1_tol/8,time)
df = pd.DataFrame({'Treacle' : treacle,
'Seeding' : seeding,
'Water' : water,
'Temperature' : temperature,
'Pression' : pression,
'pH' : pH_temp,
'Must' : out})
running = []
tmp = 1
for index, row in df.iterrows():
if tmp == 1:
if not t_treacle - t_treacle_tol <= row['Treacle'] <= t_treacle + t_treacle_tol:
tmp = 0
print(index)
elif not t_seeding - t_seeding_tol <= row['Seeding'] <= t_seeding + t_seeding_tol:
tmp = 0
print(index)
elif not t_water - t_water_tol <= row['Water'] <= t_water + t_water_tol:
tmp = 0
print(index)
elif not T_1 - T_1_tol <= row['Temperature'] <= T_1 + T_1_tol:
tmp = 0
print(index)
elif not p - p_tol <= row['Pression'] <= p + p_tol:
tmp = 0
print(index)
elif not pH - pH_tol <= row['pH'] <= pH + pH_tol:
tmp = 0
print(index)
elif not pourcentage_output_1 - pourcentage_output_1_tol <= row['Must'] <= pourcentage_output_1 + pourcentage_output_1_tol:
tmp = 0
print(index)
running.append(tmp)
print(tmp)
df['Running'] = running
print(df['Running'].value_counts())
return df
def separator_creation():
tour_minute = np.random.normal(tr_min,tr_min_tol/8,time)
tempature = np.random.normal(T_2,T_2_tol/8,time)
out = np.random.normal(t_output_2,t_output_2_tol/8,time)
df = pd.DataFrame({'Rotation Speed' : tour_minute,
'Temperature' : tempature,
'Output' : out})
running = []
tmp = 1
for index, row in df.iterrows():
if tmp == 1:
if not tr_min - tr_min_tol <= row['Rotation Speed'] <= tr_min + tr_min_tol:
tmp = 0
print(index)
elif not T_2 - T_2_tol <= row['Temperature'] <= T_2 + T_2_tol:
tmp = 0
print(index)
elif not t_output_2 - t_output_2_tol <= row['Output'] <= t_output_2 + t_output_2_tol:
tmp = 0
print(index)
running.append(tmp)
print(tmp)
df['Running'] = running
print(df['Running'].value_counts())
return df
def washer_creation():
hum = np.random.normal(humidity,humidity_tol/8,time)
out = np.random.normal(t_output_3,t_output_3_tol/8,time)
df = pd.DataFrame({'Humidity' : hum,
'Output' : out})
running = []
tmp = 1
for index, row in df.iterrows():
if tmp == 1:
if not humidity - humidity_tol <= row['Humidity'] <= humidity + humidity_tol:
tmp = 0
print(index)
elif not t_output_3 - t_output_3_tol <= row['Output'] <= t_output_3 + t_output_3_tol:
tmp = 0
print(index)
running.append(tmp)
print(tmp)
df['Running'] = running
print(df['Running'].value_counts())
return df
# i = 34
# fermentation_creation().to_csv('data/fermentation' + str(i) + '.txt', header = None, index = None, sep='\t')
# separator_creation().to_csv('data/separator' + str(i) + '.txt', header = None, index = None, sep='\t')
# washer_creation().to_csv('data/washer' + str(i) + '.txt', header = None, index = None, sep='\t')
for i in range(1,61):
# pass
print(i)
fermentation_creation().to_csv('data/fermentation' + str(i) + '.txt', header = None, index = None, sep='\t')
separator_creation().to_csv('data/separator' + str(i) + '.txt', header = None, index = None, sep='\t')
washer_creation().to_csv('data/washer' + str(i) + '.txt', header = None, index = None, sep='\t')