Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
junzis
GitHub Repository: junzis/openap
Path: blob/master/test/test_thrust.py
532 views
1
import pandas as pd
2
import numpy as np
3
from openap import Thrust
4
from matplotlib import pyplot as plt
5
from mpl_toolkits.mplot3d.axes3d import Axes3D
6
7
8
thrust = Thrust(ac='A320', eng='CFM56-5B4')
9
10
print('-'*70)
11
12
T = thrust.takeoff(tas=100, alt=0)
13
print("thrust.takeoff(tas=100, alt=0)")
14
print(T)
15
print('-'*70)
16
17
T = thrust.climb(tas=200, alt=20000, roc=1000)
18
print("thrust.climb(tas=200, alt=20000, roc=1000)")
19
print(T)
20
print('-'*70)
21
22
T = thrust.cruise(tas=230, alt=32000)
23
print("thrust.cruise(tas=230, alt=32000)")
24
print(T)
25
print('-'*70)
26
27
T = thrust.climb(tas=[200], alt=[20000], roc=[1000])
28
print("thrust.climb(tas=[200], alt=[20000], roc=[1000])")
29
print(T)
30
print('-'*70)
31
32
33
def plot():
34
# Thrust = Thrust('A320', 'CFM56-5B4')
35
thrust = Thrust('A320', 'V2500-A1')
36
37
fig = plt.figure(figsize=(10,8))
38
39
ax = fig.add_subplot(111, projection='3d')
40
41
tas = np.arange(0, 500, 20)
42
alt = np.arange(0, 35000, 2000)
43
x, y = np.meshgrid(tas, alt)
44
45
thr_to = thrust.takeoff(x, y)
46
thr_cl = thrust.climb(x, y, 2000)
47
48
c1, c2, c3 = .14231E+06, .51680E+05, .56809E-10
49
thr_bada = c1 * (1 - y / c2 + c3 * y**2)
50
51
plt.title('inflight')
52
ax.plot_wireframe(x, y, thr_to, color='r', label='OpenAP-Thrust-TO')
53
ax.plot_wireframe(x, y, thr_cl, color='g', label='Open-Thrust-CL')
54
ax.plot_wireframe(x, y, thr_bada, color='b', label='BADA3')
55
ax.set_xlabel('tas (kts)')
56
ax.set_ylabel('alt (ft)')
57
ax.set_zlabel('thr (N)')
58
# ax.view_init(20, 40)
59
ax.legend()
60
plt.tight_layout()
61
plt.show()
62
63