1
0
mirror of https://gitlab.com/lander-team/air-prop-simulation.git synced 2025-07-25 23:51:37 +00:00

updated values to match tradestudy

This commit is contained in:
2021-03-22 06:34:02 -07:00
parent 2ec48e46b5
commit f8cc74c614
3 changed files with 19 additions and 9 deletions

View File

@@ -2,7 +2,6 @@ using Unitful
using DataFrames
using Plots
using UnitfulRecipes
using Roots
using CSV
using Measurements
using Printf
@@ -12,14 +11,13 @@ using Printf
V = (85 ± 5)u"inch^3"
P0 = (4200.0 ± 300)u"psi"
Wtank = (2.3 ± 0.2)u"lb"
Pmax = (800 ± 50)u"psi"
Pmax = (250 ± 50)u"psi" # Max Pressure that can come out the nozzle
Wsolenoid = 1.5u"kg"
# Params
d_nozzle = ((1 // 16) ± 0.001)u"inch"
a_nozzle = (pi / 4) * d_nozzle^2
Poutmax = (800 ± 50)u"psi"
# Universal Stuff
P_amb = (1 ± 0.2)u"atm"
@@ -34,7 +32,7 @@ M = V * (P / (R * T)) |> u"kg"
ts = 1u"ms"
df = DataFrame(Thrust = (0 ± 0)u"N", Pressure = P, Time = t, Mass = M)
while M > 0.01u"kg"
while M > 0.005u"kg"
# while t < 30u"s"
# Calculate what is leaving tank
P = minimum([P, Pmax])
@@ -52,7 +50,7 @@ while M > 0.01u"kg"
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)
@@ -63,7 +61,7 @@ println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass))
print(describe(df))
plot(df.Time[1:150:end], df.Thrust[1:150:end], title = "Thrust Over Time")
plot(df.Time[1:350:end], df.Thrust[1:350:end], title = "Thrust Over Time")
### Save data to readme.md
@@ -77,13 +75,20 @@ table = String(take!(b)); # https://stackoverflow.com/a/60443621/8774114
readme = Printf.@sprintf """
# Air Prop Thrust
Total Impulse: %s
Burn TIme: %s
![Thrust Over Time](ThrustCurve.png)
More Data:
%s
""" impulse table
`readme auto generated`
""" impulse final_time table
println(readme)
write("readme.md", readme)