-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·60 lines (47 loc) · 1.82 KB
/
main.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
#!/usr/bin/env python3
import time as t
import sys
import numpy as np
from Simulator import Simulate
from Instrument import probe
from Balloon import Balloon
from Visualization import Viz
from datetime import datetime
def status(progress: float) -> None:
progress = progress * 100.0
sys.stdout.write('Progress: \033[K' + ('%.2f' % progress) + '%\r')
def main():
print("-- Started Simulation --")
# Simulate for 3 hours
tfinal: float = 3 * 60 * 60
time_str = t.strftime("%Hh%Mm%Ss", t.gmtime(tfinal))
print(f"Duration: {time_str}")
models = {'Kaymond 3000': {"mass": 3000, "burst_d": 13.0},
'Kaymond 2000': {"mass": 2000, "burst_d": 10.5},
'Kaymond 1000': {"mass": 1000, "burst_d": 7.86}
}
model = "Kaymond 3000"
balloon = Balloon(balloon_mass=models[model]["mass"], #
payload_mass=3, #
initial_volume=8, #
burst_diameter=models[model]["burst_d"], #
drag_coef=0.35, #
parachute_diameter=1.5,
initial_loc=(-21.9, -47.0),
start_date=datetime.now(),
parachute_drag_coeff=0.6)
state = np.vstack([0.0, # velocity
0.0, # acceleration
balloon.initial_m_gas, # gas mass
balloon.initial_loc[0],
balloon.initial_loc[1]
])
data, time = Simulate(state, balloon.Model, time_start=0,
time_end=tfinal, time_step=.5, status=status)
# Plot Simulation Data
data = np.array(data)
# Join probed data
data = np.column_stack((data, probe.get()))
Viz(data, time)
if __name__ == '__main__':
main()