Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
junzis
GitHub Repository: junzis/openap
Path: blob/master/scripts/plot_fuel_model.py
592 views
1
from glob import glob
2
3
import matplotlib.pyplot as plt
4
import yaml
5
6
import numpy as np
7
8
files = sorted(glob("../openap/data/fuel/*.yml"))
9
10
11
def func_fuel(x, coef):
12
return -coef * (x - 1) ** 2 + coef
13
14
15
for file in files:
16
with open(file, "r") as f:
17
params = yaml.safe_load(f.read())
18
name = f"{params['aircraft']} ({params['engine']})"
19
# print(name)
20
21
x = np.linspace(0, 1, 100)
22
23
y = func_fuel(x, params["fuel_coef"])
24
25
plt.plot(x, y, label=name)
26
plt.xlabel("$T / T_{max}$")
27
plt.ylabel("Fuel flow (kg/s)")
28
29
plt.legend(loc="upper left", bbox_to_anchor=(1.05, 1), ncol=1)
30
31
plt.show()
32
33