Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
junzis
GitHub Repository: junzis/openap
Path: blob/master/scripts/inspect_engine_ff_emission.py
592 views
1
import numpy as np
2
from openap import prop
3
from pprint import pprint as print
4
import matplotlib.pyplot as plt
5
6
acs = prop.available_aircraft()
7
8
for ac in acs:
9
engs = prop.aircraft_engine_options(ac)
10
for eng in engs:
11
12
try:
13
e = prop.engine(eng)
14
print(e)
15
except (KeyError, ValueError):
16
print(f"{eng} from {ac} cannot be found.")
17
continue
18
19
c3, c2, c1 = (
20
e["fuel_c3"],
21
e["fuel_c2"],
22
e["fuel_c1"],
23
)
24
25
x = np.array([0.07, 0.3, 0.85, 1.0])
26
xx = np.linspace(0, 1, 100)
27
28
plt.suptitle(f"{ac} / {eng}")
29
30
plt.subplot(221)
31
plt.scatter(x, [e["ff_idl"], e["ff_app"], e["ff_co"], e["ff_to"]])
32
plt.plot(xx, prop.func_fuel(e["fuel_c3"], e["fuel_c2"], e["fuel_c1"])(xx))
33
plt.ylabel("Fuel flow (kg)")
34
plt.xlabel("Thrust ratio")
35
36
plt.subplot(222)
37
plt.plot(
38
[e["ff_idl"], e["ff_app"], e["ff_co"], e["ff_to"]],
39
[e["ei_nox_idl"], e["ei_nox_app"], e["ei_nox_co"], e["ei_nox_to"]],
40
".--",
41
)
42
plt.ylabel("EI NOx")
43
plt.xlabel("Fuel flow (kg)")
44
45
plt.subplot(223)
46
plt.plot(
47
[e["ff_idl"], e["ff_app"], e["ff_co"], e["ff_to"]],
48
[e["ei_co_idl"], e["ei_co_app"], e["ei_co_co"], e["ei_co_to"]],
49
".--",
50
)
51
plt.ylabel("EI COx")
52
plt.xlabel("Fuel flow (kg)")
53
54
plt.subplot(224)
55
plt.plot(
56
[e["ff_idl"], e["ff_app"], e["ff_co"], e["ff_to"]],
57
[e["ei_hc_idl"], e["ei_hc_app"], e["ei_hc_co"], e["ei_hc_to"]],
58
".--",
59
)
60
plt.ylabel("EI HCx")
61
plt.xlabel("Fuel flow (kg)")
62
63
plt.tight_layout()
64
plt.draw()
65
plt.waitforbuttonpress(-1)
66
plt.clf()
67
68