forked from djlee9812/prop-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include script to calculate propulsion parameters over 24 hour cycle
- Loading branch information
Showing
15 changed files
with
381 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
LRP01 | ||
1.000132 0.1342817E-02 | ||
0.9960245 0.1957474E-02 | ||
0.9893750 0.2969499E-02 | ||
0.9803872 0.4339365E-02 | ||
0.9698709 0.5923217E-02 | ||
0.9587835 0.7580160E-02 | ||
0.9475582 0.9243152E-02 | ||
0.9363115 0.1088997E-01 | ||
0.9250723 0.1251254E-01 | ||
0.9138514 0.1410347E-01 | ||
0.9026439 0.1565691E-01 | ||
0.8914408 0.1717064E-01 | ||
0.8802320 0.1864479E-01 | ||
0.8690102 0.2008223E-01 | ||
0.8577757 0.2148551E-01 | ||
0.8465292 0.2285662E-01 | ||
0.8352741 0.2419714E-01 | ||
0.8240152 0.2550691E-01 | ||
0.8127525 0.2678558E-01 | ||
0.8014854 0.2803355E-01 | ||
0.7902154 0.2925074E-01 | ||
0.7789409 0.3043706E-01 | ||
0.7676588 0.3159371E-01 | ||
0.7563691 0.3272208E-01 | ||
0.7450726 0.3382306E-01 | ||
0.7337673 0.3489804E-01 | ||
0.7224527 0.3594901E-01 | ||
0.7111310 0.3697733E-01 | ||
0.6998028 0.3798388E-01 | ||
0.6884670 0.3897016E-01 | ||
0.6771251 0.3993762E-01 | ||
0.6657807 0.4088662E-01 | ||
0.6544351 0.4181690E-01 | ||
0.6430878 0.4272852E-01 | ||
0.6317407 0.4362140E-01 | ||
0.6203963 0.4449450E-01 | ||
0.6090542 0.4534658E-01 | ||
0.5977127 0.4617715E-01 | ||
0.5863729 0.4698572E-01 | ||
0.5750370 0.4777097E-01 | ||
0.5637038 0.4853146E-01 | ||
0.5523707 0.4926673E-01 | ||
0.5410382 0.4997657E-01 | ||
0.5297082 0.5065992E-01 | ||
0.5183779 0.5131585E-01 | ||
0.5070419 0.5194522E-01 | ||
0.4957006 0.5254970E-01 | ||
0.4843603 0.5312932E-01 | ||
0.4730238 0.5368244E-01 | ||
0.4616874 0.5420822E-01 | ||
0.4503490 0.5470718E-01 | ||
0.4390136 0.5517905E-01 | ||
0.4276850 0.5562176E-01 | ||
0.4163602 0.5603344E-01 | ||
0.4050356 0.5641387E-01 | ||
0.3937155 0.5676261E-01 | ||
0.3824047 0.5707723E-01 | ||
0.3711005 0.5735512E-01 | ||
0.3597991 0.5759543E-01 | ||
0.3485047 0.5779731E-01 | ||
0.3372228 0.5795779E-01 | ||
0.3259509 0.5807348E-01 | ||
0.3146850 0.5814292E-01 | ||
0.3034305 0.5816460E-01 | ||
0.2921933 0.5813453E-01 | ||
0.2809695 0.5804856E-01 | ||
0.2697567 0.5790473E-01 | ||
0.2585629 0.5770031E-01 | ||
0.2473924 0.5742971E-01 | ||
0.2362393 0.5708828E-01 | ||
0.2251059 0.5667359E-01 | ||
0.2140026 0.5618067E-01 | ||
0.2029283 0.5560235E-01 | ||
0.1918794 0.5493441E-01 | ||
0.1808678 0.5417251E-01 | ||
0.1698985 0.5330801E-01 | ||
0.1589662 0.5233431E-01 | ||
0.1480847 0.5124709E-01 | ||
0.1372679 0.5003636E-01 | ||
0.1265192 0.4869237E-01 | ||
0.1158634 0.4720707E-01 | ||
0.1053206 0.4556424E-01 | ||
0.9490420E-01 0.4374998E-01 | ||
0.8465507E-01 0.4175062E-01 | ||
0.7460264E-01 0.3954503E-01 | ||
0.6479600E-01 0.3711873E-01 | ||
0.5529268E-01 0.3445031E-01 | ||
0.4616051E-01 0.3152977E-01 | ||
0.3751856E-01 0.2836436E-01 | ||
0.2954695E-01 0.2500668E-01 | ||
0.2250906E-01 0.2157828E-01 | ||
0.1665630E-01 0.1827284E-01 | ||
0.1207122E-01 0.1526326E-01 | ||
0.8607730E-02 0.1262341E-01 | ||
0.6023336E-02 0.1032531E-01 | ||
0.4090792E-02 0.8305022E-02 | ||
0.2644809E-02 0.6501846E-02 | ||
0.1577218E-02 0.4864914E-02 | ||
0.8144576E-03 0.3360542E-02 | ||
0.3082285E-03 0.1969125E-02 | ||
0.4089831E-04 0.6775355E-03 | ||
0.2860174E-04 -0.5302146E-03 | ||
0.3448928E-03 -0.1730799E-02 | ||
0.1077847E-02 -0.2860658E-02 | ||
0.2207582E-02 -0.3852420E-02 | ||
0.3692011E-02 -0.4741108E-02 | ||
0.5553777E-02 -0.5590687E-02 | ||
0.7892403E-02 -0.6446675E-02 | ||
0.1089060E-01 -0.7336800E-02 | ||
0.1483721E-01 -0.8282039E-02 | ||
0.2010874E-01 -0.9277904E-02 | ||
0.2701629E-01 -0.1027195E-01 | ||
0.3547642E-01 -0.1115761E-01 | ||
0.4507140E-01 -0.1185069E-01 | ||
0.5533680E-01 -0.1235495E-01 | ||
0.6595275E-01 -0.1268781E-01 | ||
0.7676462E-01 -0.1287436E-01 | ||
0.8770191E-01 -0.1293548E-01 | ||
0.9872617E-01 -0.1289112E-01 | ||
0.1098135 -0.1275434E-01 | ||
0.1209568 -0.1253839E-01 | ||
0.1321400 -0.1225469E-01 | ||
0.1433578 -0.1191053E-01 | ||
0.1546087 -0.1151492E-01 | ||
0.1658817 -0.1107509E-01 | ||
0.1771743 -0.1059526E-01 | ||
0.1884876 -0.1008114E-01 | ||
0.1998120 -0.9537805E-02 | ||
0.2111415 -0.8966754E-02 | ||
0.2224788 -0.8369442E-02 | ||
0.2338218 -0.7748449E-02 | ||
0.2451656 -0.7104639E-02 | ||
0.2565144 -0.6437972E-02 | ||
0.2678751 -0.5750770E-02 | ||
0.2792465 -0.5046782E-02 | ||
0.2906247 -0.4328251E-02 | ||
0.3020129 -0.3596724E-02 | ||
0.3134162 -0.2855513E-02 | ||
0.3248324 -0.2108931E-02 | ||
0.3362555 -0.1359992E-02 | ||
0.3476798 -0.6111346E-03 | ||
0.3590938 0.1337164E-03 | ||
0.3704977 0.8710705E-03 | ||
0.3818969 0.1599271E-02 | ||
0.3932922 0.2317585E-02 | ||
0.4046802 0.3024409E-02 | ||
0.4160607 0.3717351E-02 | ||
0.4274375 0.4394886E-02 | ||
0.4388128 0.5056662E-02 | ||
0.4501844 0.5701927E-02 | ||
0.4615496 0.6328843E-02 | ||
0.4729103 0.6935652E-02 | ||
0.4842700 0.7521675E-02 | ||
0.4956283 0.8086677E-02 | ||
0.5069820 0.8629602E-02 | ||
0.5183306 0.9148614E-02 | ||
0.5296769 0.9642479E-02 | ||
0.5410228 0.1011096E-01 | ||
0.5523665 0.1055365E-01 | ||
0.5637053 0.1096918E-01 | ||
0.5750401 0.1135598E-01 | ||
0.5863740 0.1171332E-01 | ||
0.5977073 0.1204115E-01 | ||
0.6090371 0.1233879E-01 | ||
0.6203619 0.1260468E-01 | ||
0.6316842 0.1283762E-01 | ||
0.6430061 0.1303735E-01 | ||
0.6543260 0.1320367E-01 | ||
0.6656411 0.1333549E-01 | ||
0.6769522 0.1343131E-01 | ||
0.6882622 0.1349046E-01 | ||
0.6995714 0.1351302E-01 | ||
0.7108767 0.1349842E-01 | ||
0.7221774 0.1344525E-01 | ||
0.7334764 0.1335264E-01 | ||
0.7447752 0.1322075E-01 | ||
0.7560708 0.1304942E-01 | ||
0.7673616 0.1283748E-01 | ||
0.7786504 0.1258400E-01 | ||
0.7899392 0.1228928E-01 | ||
0.8012246 0.1195343E-01 | ||
0.8125053 0.1157534E-01 | ||
0.8237847 0.1115434E-01 | ||
0.8350634 0.1069111E-01 | ||
0.8463372 0.1018551E-01 | ||
0.8576070 0.9636223E-02 | ||
0.8688764 0.9043389E-02 | ||
0.8801418 0.8407616E-02 | ||
0.8914019 0.7727612E-02 | ||
0.9026606 0.7003238E-02 | ||
0.9139127 0.6235262E-02 | ||
0.9251552 0.5422063E-02 | ||
0.9363835 0.4563512E-02 | ||
0.9475807 0.3656656E-02 | ||
0.9587273 0.2698780E-02 | ||
0.9697131 0.1699248E-02 | ||
0.9801422 0.6975116E-03 | ||
0.9890846 -0.2040411E-03 | ||
0.9957421 -0.9003759E-03 | ||
0.9998687 -0.1342817E-02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
XFOIL Version 6.97 | ||
|
||
Calculated polar for: LRP01 | ||
|
||
1 1 Reynolds number fixed Mach number fixed | ||
|
||
xtrf = 1.000 (top) 1.000 (bottom) | ||
Mach = 0.300 Re = 0.100 e 6 Ncrit = 5.000 | ||
|
||
alpha CL CD CDp CM Top_Xtr Bot_Xtr | ||
------ -------- --------- --------- -------- -------- -------- | ||
-5.000 -0.3054 0.05136 0.04652 -0.0491 1.0001 0.0255 | ||
-4.000 -0.1684 0.02864 0.02213 -0.0735 1.0001 0.0243 | ||
-3.000 -0.0352 0.01876 0.01030 -0.0785 1.0001 0.0315 | ||
-2.000 0.0896 0.01476 0.00598 -0.0798 1.0001 0.0863 | ||
-1.000 0.2309 0.01283 0.00530 -0.0855 0.9857 0.5199 | ||
0.000 0.3827 0.01142 0.00447 -0.0902 0.9244 0.9999 | ||
1.000 0.5226 0.01140 0.00395 -0.0922 0.8103 0.9999 | ||
2.000 0.6403 0.01224 0.00397 -0.0892 0.6337 0.9999 | ||
3.000 0.7500 0.01387 0.00487 -0.0861 0.4719 0.9999 | ||
4.000 0.8593 0.01581 0.00642 -0.0836 0.3442 0.9999 | ||
5.000 0.9670 0.01816 0.00868 -0.0810 0.2392 0.9999 | ||
6.000 1.0710 0.02122 0.01191 -0.0778 0.1569 0.9999 | ||
7.000 1.1672 0.02545 0.01658 -0.0737 0.0860 0.9999 | ||
8.000 1.2436 0.03244 0.02426 -0.0673 0.0461 0.9999 | ||
9.000 1.2869 0.04318 0.03641 -0.0589 0.0311 0.9999 | ||
10.000 1.2536 0.05855 0.05312 -0.0512 0.0278 0.9999 | ||
11.000 1.1802 0.08571 0.08118 -0.0664 0.0279 0.9999 | ||
12.000 1.1054 0.12231 0.11798 -0.0894 0.0291 0.9999 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
Template prop lrp01.dat M0.3 | ||
|
||
2 ! Nblades | ||
|
||
0.3800 6.2832 ! CL0 CL_a | ||
-0.4000 1.2900 ! CLmin CLmax | ||
|
||
0.01140 0.03400 0.02400 0.5226 ! CD0 CD2u CD2l CLCD0 | ||
100000.0 -0.500 ! REref REexp | ||
|
||
1.0000 1.0000 1.0000 ! Rfac Cfac Bfac | ||
0.0000 0.0000 0.0000 ! Radd Cadd Badd | ||
|
||
# r c beta | ||
0.16750 0.16127 72.6928 | ||
0.20250 0.20192 68.6625 | ||
0.23750 0.24105 64.8964 | ||
0.27250 0.27730 61.3844 | ||
0.30750 0.31009 58.1103 | ||
0.34250 0.33931 55.0578 | ||
0.37750 0.36462 52.2177 | ||
0.41250 0.38581 49.5796 | ||
0.44750 0.40287 47.1315 | ||
0.48250 0.41594 44.8601 | ||
0.51750 0.42530 42.7520 | ||
0.55250 0.43127 40.7940 | ||
0.58750 0.43418 38.9736 | ||
0.62250 0.43418 37.2805 | ||
0.65750 0.43142 35.7048 | ||
0.69250 0.42603 34.2372 | ||
0.72750 0.41812 32.8695 | ||
0.76250 0.40780 31.5938 | ||
0.79750 0.39514 30.4031 | ||
0.83250 0.38024 29.2909 | ||
0.86750 0.36314 28.2513 | ||
0.90250 0.34389 27.2789 | ||
0.93750 0.32250 26.3689 | ||
0.97250 0.29892 25.5168 | ||
1.0075 0.27306 24.7185 | ||
1.0425 0.24465 23.9705 | ||
1.0775 0.21318 23.2694 | ||
1.1125 0.17760 22.6120 | ||
1.1475 0.13530 21.9956 | ||
1.1825 0.76654E-01 21.4177 | ||
1.2000 0.41207E-01 21.1431 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from mpl_toolkits.mplot3d import Axes3D | ||
from matplotlib import cm | ||
from air_data import change_air_data | ||
from qprop_sweep import opt_dbeta, get_nums | ||
|
||
def follow_trajectory(ts, hs, vs, thrusts, npt=24, unopt=False): | ||
""" | ||
Calculate propulsion parameters over a cycle trajectory and saves data | ||
to "cycle.npz" using QProp | ||
Requires time, altitude, airspeed, and thrust over the 24 hour trajectory | ||
Parameters | ||
---------- | ||
ts : array-like | ||
Points in time | ||
hs : array-like | ||
Altitudes at given time points | ||
vs : array-like | ||
Airspeeds at given time poitns | ||
thrusts : array-like | ||
Required thrust at given time points | ||
npt : int, optional | ||
Number of time samples to evaluate/optimize at | ||
unopt : boolean, optional | ||
If checked, variable pitch is not allowed | ||
""" | ||
step = len(ts) // npt if npt <= len(ts) else 1 | ||
result = [] | ||
for i, t in enumerate(ts[::step]): | ||
i *= step | ||
h, v, thrust = (hs[i], vs[i], thrusts[i]) | ||
p = thrust * v | ||
change_air_data(h) | ||
opt = opt_dbeta(v, thrust) | ||
dbeta = 0 if unopt else opt.x | ||
eta_opt = -opt.fun | ||
data = get_nums(dbeta, v, thrust) | ||
rpm = data[1] | ||
Q = data[4] | ||
Pshaft = data[5] | ||
eta = data[9] | ||
J = data[10] | ||
result.append([t, h, v, p, thrust, rpm, Q, Pshaft, J, dbeta, eta]) | ||
result = np.array(result) | ||
plt.figure() | ||
plt.title('24 Hour Trajectory') | ||
plt.subplot(211) | ||
plt.plot(result[:,0], result[:,1]/1000) | ||
plt.ylabel('Altitude [km]') | ||
plt.subplot(212) | ||
plt.plot(result[:,0], result[:,2]) | ||
plt.ylabel('Airspeed [m/s]') | ||
plt.xlabel("time [hr]") | ||
plt.show() | ||
np.savez("cycle", res=result) | ||
print("Average Efficiency:", np.mean(result[:,10])) | ||
|
||
def plot_trajectory(data_file="cycle.npz"): | ||
""" | ||
Plot various propulsion parameters from cycle.npz | ||
Parameters | ||
---------- | ||
data_file : str, optional | ||
Name/Address of file containing plot data (from follow_trajectory()) | ||
""" | ||
result = np.load(data_file)["res"].T | ||
t, h, v, p, thrust, rpm, Q, Pshaft, J, dbeta, eta = result | ||
plt.figure(figsize=(6,8)) | ||
plt.title("24 Hour Cycle") | ||
plt.subplot(411) | ||
plt.plot(t, h/1000) | ||
plt.ylabel('Altitude [km]') | ||
plt.subplot(412) | ||
plt.plot(t, rpm) | ||
plt.ylabel('RPM') | ||
plt.subplot(413) | ||
plt.plot(t, dbeta) | ||
plt.ylabel(r'$d\beta$') | ||
plt.subplot(414) | ||
plt.plot(t, eta) | ||
plt.ylabel(r'$\eta$') | ||
plt.xlabel("Time [hr]") | ||
|
||
plt.figure() | ||
plt.plot(J, eta) | ||
plt.xlabel("Advance Ratio") | ||
plt.ylabel(r"$\eta$") | ||
plt.figure() | ||
plt.plot(rpm, Q) | ||
plt.xlabel("RPM") | ||
plt.ylabel("Torque [N/m]") | ||
plt.show() | ||
|
||
data = np.load('time_altitude_airspeed.npz') | ||
ts = data['t']/3600 | ||
hs = data['h'] | ||
vs = data['v'] | ||
thrusts = data['thrust'] | ||
follow_trajectory(ts, hs, vs, thrusts, 200) | ||
|
||
plot_trajectory() |