mirror of
https://gitlab.com/lander-team/air-prop-simulation.git
synced 2025-07-23 06:31:37 +00:00
Merge branch 'monte-carlo' into 'master'
Uncertainty to Calculations See merge request lander-team/air-prop-simulation!1
This commit is contained in:
BIN
ThrustCurve.png
Normal file
BIN
ThrustCurve.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
124
calcs.jl
124
calcs.jl
@@ -1,124 +0,0 @@
|
||||
### A Pluto.jl notebook ###
|
||||
# v0.12.20
|
||||
|
||||
using Markdown
|
||||
using InteractiveUtils
|
||||
|
||||
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
|
||||
macro bind(def, element)
|
||||
quote
|
||||
local el = $(esc(element))
|
||||
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
|
||||
el
|
||||
end
|
||||
end
|
||||
|
||||
# ╔═╡ 7d1e8730-81f7-11eb-0b4d-d7c878032280
|
||||
begin
|
||||
using Unitful
|
||||
using Roots
|
||||
using PlutoUI
|
||||
end
|
||||
|
||||
# ╔═╡ d8461f50-833d-11eb-04f2-f9e262a97ba5
|
||||
md"## Air Compressor Thrust Calcs"
|
||||
|
||||
# ╔═╡ 2a976cf0-833e-11eb-3892-03869a9b0acc
|
||||
html"<button onclick='present()'>present</button>"
|
||||
|
||||
# ╔═╡ b0efd6c2-81f9-11eb-2aad-efc9bdd8c220
|
||||
@bind diam Slider(0.1:.1:6.5, default=.5)
|
||||
|
||||
# ╔═╡ bc06c722-81fa-11eb-05ac-e38ac21ce27e
|
||||
@bind p Slider(15:6000, default=126)
|
||||
|
||||
# ╔═╡ 99835750-81fe-11eb-3a7e-1132eb3cdd90
|
||||
@bind w Slider(.5:.25:20, default=5)
|
||||
|
||||
# ╔═╡ a9f59000-81f7-11eb-15c0-4520acb6543f
|
||||
begin
|
||||
M = w*u"kg"
|
||||
|
||||
P_amb = 1u"atm"
|
||||
P_c = p*u"psi"
|
||||
|
||||
d_nozzle = diam*u"mm"
|
||||
a_nozzle = (pi/4)*d_nozzle^2
|
||||
|
||||
γ = 1.4
|
||||
R = 287.05u"J/(kg * K)"
|
||||
T = 300u"K"
|
||||
|
||||
burn_time = 5u"s"
|
||||
|
||||
V = 68u"inch^3"
|
||||
end;
|
||||
|
||||
# ╔═╡ 764dcf30-81fa-11eb-3155-559823202b8f
|
||||
md"Area of Nozzle: $(a_nozzle) | $(round(u\"inch^2\",a_nozzle, digits = 4))"
|
||||
|
||||
# ╔═╡ b4a957a0-833e-11eb-1ca9-0d87d162790f
|
||||
md"Diameter of Nozzle: $(d_nozzle) | $(round(u\"inch\",d_nozzle, digits = 4))"
|
||||
|
||||
# ╔═╡ a7bef990-81fa-11eb-3976-817c3e383e64
|
||||
md"Pressure of system: $(P_c)"
|
||||
|
||||
# ╔═╡ b113c030-81fe-11eb-2042-776472e720ac
|
||||
md"Mass of Lander: $(M) | $(round(u\"lb\",M, digits = 2))"
|
||||
|
||||
# ╔═╡ a9317cb0-81f7-11eb-26e5-95719252409b
|
||||
begin
|
||||
ve = sqrt((2 * γ / (γ - 1)) * R * T * (1 - P_amb / P_c)^((γ - 1) / γ)) |> u"m/s"
|
||||
|
||||
ρ = P_c / (R * T) |> u"kg/m^3"
|
||||
ṁ = ρ * a_nozzle * ve |> u"kg/s"
|
||||
end;
|
||||
|
||||
# ╔═╡ cf5b7030-846d-11eb-2f23-290624c7d684
|
||||
M_air = ρ*V |> u"kg"
|
||||
|
||||
# ╔═╡ 2149b640-846e-11eb-262b-299ded0c61c5
|
||||
M_air / ṁ
|
||||
|
||||
# ╔═╡ c57fe2d0-81f7-11eb-27d7-4b5c0520998d
|
||||
Thrust = ṁ * ve + a_nozzle * (P_c - P_amb) |> u"N"
|
||||
|
||||
# ╔═╡ 213ef2c0-81fb-11eb-1425-15bfcf1dc14c
|
||||
volume_air = ṁ * burn_time / ρ |> u"inch^3";
|
||||
|
||||
# ╔═╡ 9388c570-833d-11eb-3baa-758b5cb19065
|
||||
md"Air Needed: $(round(ustrip(volume_air/burn_time)*.004329,digits=3)) Gallon/s"
|
||||
|
||||
# ╔═╡ e85b0e90-81fe-11eb-0dd5-0b3df376a4f7
|
||||
begin
|
||||
W_earth = 9.81u"m/s^2" * M |> u"N"
|
||||
W_moon = 1.623u"m/s^2" * M |> u"N"
|
||||
end;
|
||||
|
||||
# ╔═╡ 57844480-833a-11eb-3a57-bf00cecde849
|
||||
md"Thrust to Weight Ratio Earth: $(Thrust/W_earth)"
|
||||
|
||||
# ╔═╡ a5c735d0-833a-11eb-2bae-71ba4af6b3a1
|
||||
md"Thrust to Weight Ratio Moon: $(Thrust/W_moon)"
|
||||
|
||||
# ╔═╡ Cell order:
|
||||
# ╟─d8461f50-833d-11eb-04f2-f9e262a97ba5
|
||||
# ╟─2a976cf0-833e-11eb-3892-03869a9b0acc
|
||||
# ╟─7d1e8730-81f7-11eb-0b4d-d7c878032280
|
||||
# ╟─764dcf30-81fa-11eb-3155-559823202b8f
|
||||
# ╟─b4a957a0-833e-11eb-1ca9-0d87d162790f
|
||||
# ╟─b0efd6c2-81f9-11eb-2aad-efc9bdd8c220
|
||||
# ╟─a7bef990-81fa-11eb-3976-817c3e383e64
|
||||
# ╠═bc06c722-81fa-11eb-05ac-e38ac21ce27e
|
||||
# ╟─b113c030-81fe-11eb-2042-776472e720ac
|
||||
# ╠═99835750-81fe-11eb-3a7e-1132eb3cdd90
|
||||
# ╠═a9f59000-81f7-11eb-15c0-4520acb6543f
|
||||
# ╠═a9317cb0-81f7-11eb-26e5-95719252409b
|
||||
# ╠═2149b640-846e-11eb-262b-299ded0c61c5
|
||||
# ╠═cf5b7030-846d-11eb-2f23-290624c7d684
|
||||
# ╠═c57fe2d0-81f7-11eb-27d7-4b5c0520998d
|
||||
# ╟─213ef2c0-81fb-11eb-1425-15bfcf1dc14c
|
||||
# ╠═9388c570-833d-11eb-3baa-758b5cb19065
|
||||
# ╟─e85b0e90-81fe-11eb-0dd5-0b3df376a4f7
|
||||
# ╟─57844480-833a-11eb-3a57-bf00cecde849
|
||||
# ╟─a5c735d0-833a-11eb-2bae-71ba4af6b3a1
|
8
readme.md
Normal file
8
readme.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Air Prop Thrust
|
||||
Total Impulse: 405.0 ± 39.0 N s
|
||||
|
||||

|
||||
|
||||
More Data:
|
||||
|
||||
<table class="data-frame"><thead><tr><th></th><th>variable</th><th>mean</th><th>min</th><th>median</th><th>max</th><th>nmissing</th><th>eltype</th></tr><tr><th></th><th>Symbol</th><th>Quantity</th><th>Quantity</th><th>Quantity</th><th>Quantity</th><th>Int64</th><th>DataType</th></tr></thead><tbody><p>4 rows × 7 columns</p><tr><th>1</th><td>Thrust</td><td>69.0±6.7 N</td><td>0.0±0.0 N</td><td>86.7±9.2 N</td><td>86.7±9.2 N</td><td>0</td><td>Quantity{Measurement{Float64}, 𝐋 𝐌 𝐓^-2, FreeUnits{(N,), 𝐋 𝐌 𝐓^-2, nothing}}</td></tr><tr><th>2</th><td>Pressure</td><td>1.21e7±2.0e6 Pa</td><td>620000.0±440000.0 Pa</td><td>1.12e7±2.8e6 Pa</td><td>2.9e7±2.1e6 Pa</td><td>0</td><td>Quantity{Measurement{Float64}, 𝐌 𝐋^-1 𝐓^-2, FreeUnits{(Pa,), 𝐌 𝐋^-1 𝐓^-2, nothing}}</td></tr><tr><th>3</th><td>Time</td><td>2.9325 s</td><td>0.0 s</td><td>2.9325 s</td><td>5.865 s</td><td>0</td><td>Quantity{Float64, 𝐓, FreeUnits{(s,), 𝐓, nothing}}</td></tr><tr><th>4</th><td>Mass</td><td>0.196±0.043 kg</td><td>0.01±0.0077 kg</td><td>0.181±0.054 kg</td><td>0.468±0.053 kg</td><td>0</td><td>Quantity{Measurement{Float64}, 𝐌, FreeUnits{(kg,), 𝐌, nothing}}</td></tr></tbody></table>
|
60
thrust.jl
60
thrust.jl
@@ -4,33 +4,36 @@ using Plots
|
||||
using UnitfulRecipes
|
||||
using Roots
|
||||
using CSV
|
||||
using Measurements
|
||||
using Printf
|
||||
|
||||
|
||||
# Tank https://www.amazon.com/Empire-Paintball-BASICS-Pressure-Compressed/dp/B07B6M48SR/
|
||||
V = 90u"inch^3"
|
||||
P0 = 4500.0u"psi"
|
||||
Wtank = 2.3u"lb"
|
||||
Pmax = 100u"psi"
|
||||
V = (85 ± 5)u"inch^3"
|
||||
P0 = (4200.0 ± 300)u"psi"
|
||||
Wtank = (2.3 ± 0.2)u"lb"
|
||||
Pmax = (800 ± 50)u"psi"
|
||||
|
||||
Wsolenoid = 1.5u"kg"
|
||||
|
||||
# Params
|
||||
d_nozzle = (1 // 16) * u"inch"
|
||||
d_nozzle = ((1 // 16) ± 0.001)u"inch"
|
||||
a_nozzle = (pi / 4) * d_nozzle^2
|
||||
Poutmax = 800u"psi"
|
||||
Poutmax = (800 ± 50)u"psi"
|
||||
|
||||
# Universal Stuff
|
||||
P_amb = 1u"atm"
|
||||
γ = 1.4
|
||||
P_amb = (1 ± 0.2)u"atm"
|
||||
γ = 1.4 ± 0.05
|
||||
R = 287.05u"J/(kg * K)"
|
||||
T = 300u"K"
|
||||
T = (300 ± 20)u"K"
|
||||
|
||||
# Setting up while loop
|
||||
t = 1.0u"s"
|
||||
t = 0.0u"s"
|
||||
P = P0 |> u"Pa"
|
||||
M = V * (P / (R * T)) |> u"kg"
|
||||
df = DataFrame(Thrust = 0.0u"N", Pressure = P, Time = t, Mass = M)
|
||||
ts = 0.001u"s"
|
||||
ts = 1u"ms"
|
||||
df = DataFrame(Thrust = (0 ± 0)u"N", Pressure = P, Time = t, Mass = M)
|
||||
|
||||
while M > 0.01u"kg"
|
||||
# while t < 30u"s"
|
||||
# Calculate what is leaving tank
|
||||
@@ -49,11 +52,38 @@ while M > 0.01u"kg"
|
||||
df_step = DataFrame(Thrust = Thrust, Pressure = P, Time = t, Mass = M)
|
||||
append!(df, df_step)
|
||||
end
|
||||
|
||||
impulse = sum(df.Thrust) * ts |> u"N*s"
|
||||
println("---------------------------\n\n\n\n")
|
||||
println("Total Impulse: ", sum(df.Thrust) * ts)
|
||||
println("Total Impulse: ", impulse)
|
||||
println("Burn Time: ", t)
|
||||
|
||||
println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass))
|
||||
|
||||
|
||||
print(describe(df))
|
||||
plot(df.Time, df.Thrust, title = "Thrust Over Time")
|
||||
CSV.write("thrustdata.csv", df .|> ustrip)
|
||||
|
||||
plot(df.Time[1:150:end], df.Thrust[1:150:end], title = "Thrust Over Time")
|
||||
|
||||
### Save data to readme.md
|
||||
|
||||
savefig("ThrustCurve.png")
|
||||
|
||||
b = IOBuffer();
|
||||
t = TextDisplay(b);
|
||||
display(t, "text/html", describe(df));
|
||||
table = String(take!(b)); # https://stackoverflow.com/a/60443621/8774114
|
||||
|
||||
|
||||
readme = Printf.@sprintf """
|
||||
# Air Prop Thrust
|
||||
Total Impulse: %s
|
||||
|
||||

|
||||
|
||||
More Data:
|
||||
|
||||
%s
|
||||
""" impulse table
|
||||
|
||||
write("readme.md", readme)
|
Reference in New Issue
Block a user