1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-06-16 15:06:53 +00:00
Projects/_posts/2021-04-01-air-propulsion-simulation/air-propulsion-simulation.Rmd

161 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Air Propulsion Simulation"
description: |
Simulating the performance of an air propulsion system as an alternative to solid rocket motors.
author:
- name: Anson Biggs
url: https://ansonbiggs.com
repository_url: https://gitlab.com/lander-team/air-prop-simulation
date: 04-01-2021
fig_width: 6
fig_align: "center"
output:
distill::distill_article:
self_contained: false
categories:
- Julia
- Capstone
bibliography: ../../citations.bib
---
For my team was tasked with designing a system capable of moving mining equipment and materials around the surface of the Moon using a propolsive landing. The system had to be tested on earth with something that was feasible for our team to build in 2 semesters. One of the first considerations my capstone advisor wanted was to test the feasibility of an air propulsion system instead of the obvious solution that of using solid rocket motors. This document is really just _napkin math_ to determine if the system is even feasibly and is not mean't to be a rigorous study of an air propulsion system which would easily keep a capstone team busy by itself.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, results = 'hide')
library(JuliaCall)
#julia_setup(JULIA_HOME = "/opt/julia-1.6.0/bin/")
```
```{julia, code_folding=TRUE}
using Plots
plotly()
theme(:ggplot2); # In true R spirit
using Unitful
using DataFrames
using Measurements
using Measurements: value, uncertainty
using CSV
```
An off the shelf paintball gun tank was used for the pressure vessel. This was chosen because they are very high pressure for their weight, and are designed to be bumped around.
```{julia}
# Tank https://www.amazon.com/Empire-Paintball-BASICS-Pressure-Compressed/dp/B07B6M48SR/
V = (85 ± 5)u"inch^3"
P0 = (4200.0 ± 300)u"psi"
Wtank = (2.3 ± 0.2)u"lb"
Pmax = (250 ± 50)u"psi" # Max Pressure that can come out the nozzle
```
The nozzle diameter was changed until the air prop system had a _burn time_ similar to a G18ST rocket motor.
```{julia}
# Params
d_nozzle = ((1 // 18) ± 0.001)u"inch"
a_nozzle = (pi / 4) * d_nozzle^2
```
These are just universal values for what a normal day would look like in Arizona. [@cengel_thermodynamics]
```{julia}
# Universal Stuff
P_amb = (1 ± 0.2)u"atm"
γ = 1.4 ± 0.05
R = 287.05u"J/(kg * K)"
T = (300 ± 20)u"K"
```
This is the actual simulation. Maybe throw some references in and explain some equations.
The following equations also came from [@cengel_thermodynamics]
The rocket equation is pretty sick[@sutton_rocket_2001, eq: 2-14]:
$$T = \dot{m} \cdot v_\text{Exit} + A_\text{Nozzle} \cdot (P - P_\text{Ambient}) $$
And thats about all you need to get to the Moon[@curtis_orbital].
```{julia}
df = let
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=P0, Time=0.0u"s", 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"
ρ = P / (R * T) |> u"kg/m^3"
ṁ = ρ * a_nozzle * ve |> u"kg/s"
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)
append!(df, df_step)
end
df
end
```
breakdown of the data
```{julia, layout="l-body", echo=FALSE, results='asis'}
b = IOBuffer();
t = TextDisplay(b);
display(t, "text/html", describe(df));
table = String(take!(b)); # https://stackoverflow.com/a/60443621/8774114
```
Heres the results plotted. Notice the massive error once the tank starts running low.
```{julia, code_folding=TRUE, results='show',layout="l-body-outset", fig.cap = "Air Proplsion Simulation"}
thrust_values = df.Thrust .|> ustrip .|> value;
thrust_uncertainties = df.Thrust .|> ustrip .|> uncertainty;
air = DataFrame(Thrust=thrust_values, Uncertainty=thrust_uncertainties, Time=df.Time .|> u"s" .|> ustrip);
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)",
size = (1200, 800),
)
```
Here the air prop is plotted along with rocket motors that are being
```{julia, code_folding=TRUE, results='show',layout="l-body-outset",fig.cap= "Rocket Motor Data: [@thrustcurve]"}
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", fillalpha=.1, legend=:topleft, size = (1200, 800));
for (d, l) in [(f10, "F10"), (f15, "F15"), (g8, "G8ST")]
plot!(d[!,"Time (s)"], d[!, "Thrust (N)"], label=l);
end
title!("Propulsion Comparison");
xlabel!("Time (s)");
ylabel!("Thrust (N)")
```
Big conclusion about things.