-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
101 lines (77 loc) · 2.49 KB
/
Copy pathmain.py
File metadata and controls
101 lines (77 loc) · 2.49 KB
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
from library.componentes.chamber import PlotPump, Pump_fermi, Pump_old
from library.componentes.velves import Velve, PlotVelve, Velve_fermi
from library.componentes.tubes import Tube, PlotTubes
from library.signals import Rectangle, Sinus, PlotSignal
from simulation.first_order import velve_test, system_test
from graphics.create_plots import PlotManager
from system_manager import SystemManager
import numpy as np
plots = [
PlotSignal(),
PlotVelve(),
PlotPump(),
PlotTubes()
]
class System(SystemManager):
Pr_in = 0 # reservoirdruck
Pr_out = 0 # reservoirdruck
Pc0 = 0 # startdruck in der pumpkammer
T = 1e-3 # simulationsdauer
steps = 1000 # anzahl der zeitschritte
class signal:
_comp = Rectangle
amplitude = 1
frequency = 2e3
offset = 0
class pump():
_comp = Pump_fermi
K = 1
RC=0.00001
class velve_in:
_comp = Velve
R_open = 2e6
R_close = 1e15
direction = 'forward'
# direction = 'backward'
class velve_out:
_comp = Velve
R_open = 2e6
R_close = 1e15
# direction = 'forward'
direction = 'backward'
class tube_in:
_comp = Tube
diameter = 1e-3
length = 100e-3
class tube_out:
_comp = Tube
diameter = 1e-3
length = 100e-3
def corner_frequency():
system = System()
param_range = np.linspace(0, 1e5, 10) / 1
#param_range = np.linspace(10e-3, 100e-3, 10) / 1
chamber_pressure = dict()
for new_param in param_range:
# system.tube_in.length = new_param
system.Pr_in = new_param
components = system.get_components()
parameter = system.get_parameter()
time, y_data = system_test(**components, **parameter)
chamber_pressure.update({f'{new_param:.4f}':y_data['chamber']})
pm = PlotManager()
pm.plot_dict(time, y_data,
title='Simple Pump',
xlabel='Time [s]',
ylabel='Voltage [V]',
filename=f'backpressure/{new_param:.4f}')
chamber_pressure.update({'signal_voltage': y_data['signal_voltage']})
pm.plot_dict(time, chamber_pressure,
title='Backpressure',
xlabel='Time [s]',
ylabel='Chamber pressure [Pa]',
filename=f'backpressure/pressure_sweep')
if __name__ == '__main__':
# for plot in plots:
# plot.plot()
corner_frequency()