diff --git a/Presentation.png b/Presentation.png deleted file mode 100644 index f143241..0000000 Binary files a/Presentation.png and /dev/null differ diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..a34cf07 --- /dev/null +++ b/Project.toml @@ -0,0 +1,6 @@ +[deps] +CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" diff --git a/SSAD.png b/SSAD.png deleted file mode 100644 index ae5aef9..0000000 Binary files a/SSAD.png and /dev/null differ diff --git a/ThrustCurve.png b/ThrustCurve.png index 24eeacf..782a17d 100644 Binary files a/ThrustCurve.png and b/ThrustCurve.png differ diff --git a/air_prop_sim.jl b/air_prop_sim.jl index ddf7ad3..06b9680 100644 --- a/air_prop_sim.jl +++ b/air_prop_sim.jl @@ -1,14 +1,12 @@ using Unitful using DataFrames using Plots -theme(:ggplot2); -using UnitfulRecipes +theme(:ggplot2); using CSV using Measurements using Measurements: value, uncertainty using Printf - # Tank https://www.amazon.com/Empire-Paintball-BASICS-Pressure-Compressed/dp/B07B6M48SR/ V = (85 ± 5)u"inch^3" P0 = (4200.0 ± 300)u"psi" @@ -27,15 +25,13 @@ P_amb = (1 ± 0.2)u"atm" R = 287.05u"J/(kg * K)" T = (300 ± 20)u"K" -# Setting up while loop t = 0.0u"s" P = P0 |> u"Pa" M = V * (P / (R * T)) |> u"kg" ts = 1u"ms" -df = DataFrame(Thrust=(0 ± 0)u"N", Pressure=P, Time=t, Mass=M) +df = DataFrame(Thrust = (0 ± 0)u"N", Pressure = P, Time = t, Mass = M) while M > 0.005u"kg" - # while t < 30u"s" # Calculate what is leaving tank P = minimum([P, Pmax]) ve = sqrt((2 * γ / (γ - 1)) * R * T * (1 - P_amb / P)^((γ - 1) / γ)) |> u"m/s" @@ -44,65 +40,80 @@ while M > 0.005u"kg" Thrust = ṁ * ve + a_nozzle * (P - P_amb) |> u"N" - # Calculate what is still in the tank M = M - ṁ * ts |> u"kg" P = (M * R * T) / V |> u"Pa" t = t + ts - df_step = DataFrame(Thrust=Thrust, Pressure=P, Time=t, Mass=M) + df_step = DataFrame(Thrust = Thrust, Pressure = P, Time = t, Mass = M) append!(df, df_step) end final_time = t |> u"s" impulse = sum(df.Thrust) * ts |> u"N*s" println("---------------------------\n\n\n\n") -println("Total Impulse: ", impulse) println("Burn Time: ", t) println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass)) - print(describe(df)) thrust_values = df.Thrust .|> ustrip .|> value -thrust_uncertainties = df.Thrust .|> ustrip .|> uncertainty +thrust_uncertainties = df.Thrust .|> ustrip .|> uncertainty -plot(df.Time .|> ustrip, thrust_values, - title="Thrust Over Time", - ribbon=(thrust_uncertainties, thrust_uncertainties), - fillalpha=.2,label="Thrust", - xlabel="Time (s)", - ylabel="Thrust (N)", - palette=:leonardo, - ) +plot( + df.Time .|> ustrip, + thrust_values, + title = "Thrust Over Time", + ribbon = (thrust_uncertainties, thrust_uncertainties), + fillalpha = 0.2, + label = "Thrust", + xlabel = "Time (s)", + ylabel = "Thrust (N)", + palette = :leonardo, +) -out = DataFrame(Thrust=thrust_values, Uncertainty=thrust_uncertainties, Time=df.Time .|> u"s" .|> ustrip) -CSV.write("AirProp.csv",out) +out = DataFrame( + Thrust = thrust_values, + Uncertainty = thrust_uncertainties, + Time = df.Time .|> u"s" .|> ustrip, +) +CSV.write("AirProp.csv", out) ### Save data to readme.md savefig("ThrustCurve.png") +include("prop_compare.jl") + b = IOBuffer(); t = TextDisplay(b); display(t, "text/html", describe(df)); table = String(take!(b)); # https://stackoverflow.com/a/60443621/8774114 +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 +`readme auto generated, run air_prop_sim.jl to recreate.` + +![Thrust Over Time](ThrustCurve.png) + Total Impulse: %s Burn TIme: %s -![Thrust Over Time](ThrustCurve.png) - More Data: %s -`readme auto generated` +## Comparison to Rocket Motors + +![Propulsion Comparison](prop_compare.png) + +https://www.thrustcurve.org/ + """ impulse final_time table - -write("readme.md", readme); \ No newline at end of file +write("readme.md", readme); diff --git a/prop_compare.jl b/prop_compare.jl index 107a11e..4972017 100644 --- a/prop_compare.jl +++ b/prop_compare.jl @@ -1,7 +1,7 @@ using CSV using DataFrames using Plots -theme(:juno) +theme(:ggplot2) air = CSV.read("AirProp.csv", DataFrame) @@ -9,15 +9,21 @@ f10 = CSV.read("AeroTech_F10.csv", DataFrame) f15 = CSV.read("Estes_F15.csv", DataFrame) g8 = CSV.read("AeroTech_G8ST.csv", DataFrame) - -plot(air.Time, air.Thrust, label="Air Propulsion", ribbon=(zeros(length(df.Time)), min.(15, air.Uncertainty)), fillalpha=.1, legend=:topleft) +plot( + air.Time, + air.Thrust, + label = "Air Propulsion", + ribbon = (zeros(length(df.Time)), min.(15, air.Uncertainty)), + fillalpha = 0.1, + legend = :topleft, +) for (d, l) in [(f10, "F10"), (f15, "F15"), (g8, "G8ST")] - plot!(d[!,"Time (s)"], d[!, "Thrust (N)"], label=l) + plot!(d[!, "Time (s)"], d[!, "Thrust (N)"], label = l) end title!("Propulsion Comparison") xlabel!("Time (s)") ylabel!("Thrust (N)") -savefig("Presentation.png") \ No newline at end of file +savefig("prop_compare.png") \ No newline at end of file diff --git a/prop_compare.png b/prop_compare.png new file mode 100644 index 0000000..37296c9 Binary files /dev/null and b/prop_compare.png differ diff --git a/readme.md b/readme.md index 2e62c64..38bb5d1 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,20 @@ # Air Prop Thrust +`readme auto generated` + +![Thrust Over Time](ThrustCurve.png) + Total Impulse: 405.0 ± 40.0 N s Burn TIme: 20.30300000000183 s -![Thrust Over Time](ThrustCurve.png) - More Data: -

4 rows × 7 columns

variablemeanminmedianmaxnmissingeltype
SymbolQuantityQuantityQuantityQuantityInt64DataType
1Thrust20.0±2.0 N0.0±0.0 N21.1±4.7 N21.1±4.7 N0Quantity{Measurement{Float64}, 𝐋 𝐌 𝐓^-2, FreeUnits{(N,), 𝐋 𝐌 𝐓^-2, nothing}}
2Pressure1.39e7±3.6e6 Pa300000.0±1.1e6 Pa1.38e7±3.9e6 Pa2.9e7±2.1e6 Pa0Quantity{Measurement{Float64}, 𝐌 𝐋^-1 𝐓^-2, FreeUnits{(Pa,), 𝐌 𝐋^-1 𝐓^-2, nothing}}
3Time10.1515 s0.0 s10.1515 s20.303 s0Quantity{Float64, 𝐓, FreeUnits{(s,), 𝐓, nothing}}
4Mass0.225±0.066 kg0.005±0.018 kg0.224±0.071 kg0.468±0.053 kg0Quantity{Measurement{Float64}, 𝐌, FreeUnits{(kg,), 𝐌, nothing}}
+

4 rows × 7 columns

variablemeanminmedianmaxnmissingeltype
SymbolQuantityQuantityQuantityQuantityInt64DataType
1Thrust20.0±2.0 N0.0±0.0 N21.1±4.7 N21.1±4.7 N0Quantity{Measurement{Float64}, 𝐋 𝐌 𝐓^-2, FreeUnits{(N,), 𝐋 𝐌 𝐓^-2, nothing}}
2Pressure1.39e7±3.6e6 Pa310000.0±1.1e6 Pa1.38e7±3.9e6 Pa2.9e7±2.1e6 Pa0Quantity{Measurement{Float64}, 𝐌 𝐋^-1 𝐓^-2, FreeUnits{(Pa,), 𝐌 𝐋^-1 𝐓^-2, nothing}}
3Time10.1515 s0.0 s10.1515 s20.303 s0Quantity{Float64, 𝐓, FreeUnits{(s,), 𝐓, nothing}}
4Mass0.225±0.066 kg0.005±0.018 kg0.224±0.071 kg0.468±0.053 kg0Quantity{Measurement{Float64}, 𝐌, FreeUnits{(kg,), 𝐌, nothing}}
+ +## Comparison to Rocket Motors + +![Propulsion Comparison](prop_compare.png) + +https://www.thrustcurve.org/ -`readme auto generated`