diff --git a/ThrustCurve.png b/ThrustCurve.png new file mode 100644 index 0000000..ac42fec Binary files /dev/null and b/ThrustCurve.png differ diff --git a/calcs.jl b/calcs.jl deleted file mode 100644 index 6fd4137..0000000 --- a/calcs.jl +++ /dev/null @@ -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"" - -# ╔═╡ 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 diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..9531269 --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# Air Prop Thrust +Total Impulse: 405.0 ± 39.0 N s + +![Thrust Over Time](ThrustCurve.png) + +More Data: + +

4 rows × 7 columns

variablemeanminmedianmaxnmissingeltype
SymbolQuantityQuantityQuantityQuantityInt64DataType
1Thrust69.0±6.7 N0.0±0.0 N86.7±9.2 N86.7±9.2 N0Quantity{Measurement{Float64}, 𝐋 𝐌 𝐓^-2, FreeUnits{(N,), 𝐋 𝐌 𝐓^-2, nothing}}
2Pressure1.21e7±2.0e6 Pa620000.0±440000.0 Pa1.12e7±2.8e6 Pa2.9e7±2.1e6 Pa0Quantity{Measurement{Float64}, 𝐌 𝐋^-1 𝐓^-2, FreeUnits{(Pa,), 𝐌 𝐋^-1 𝐓^-2, nothing}}
3Time2.9325 s0.0 s2.9325 s5.865 s0Quantity{Float64, 𝐓, FreeUnits{(s,), 𝐓, nothing}}
4Mass0.196±0.043 kg0.01±0.0077 kg0.181±0.054 kg0.468±0.053 kg0Quantity{Measurement{Float64}, 𝐌, FreeUnits{(kg,), 𝐌, nothing}}
diff --git a/thrust.jl b/thrust.jl index 4284e77..6e5e423 100644 --- a/thrust.jl +++ b/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 + +![Thrust Over Time](ThrustCurve.png) + +More Data: + +%s +""" impulse table + +write("readme.md", readme) \ No newline at end of file