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

switched to measurements.jl

This commit is contained in:
2021-03-22 06:06:00 -07:00
parent 6c5f6b8459
commit b9237f9a43
2 changed files with 18 additions and 147 deletions

View File

@@ -1,20 +1,17 @@
using Unitful
using DataFrames
using Plots
# using Gadfly
using UnitfulRecipes
using Roots
using CSV
using MonteCarloMeasurements
using Measurements
unsafe_comparisons(true)
# 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 = (100 ± 5)u"psi"
Pmax = (800 ± 50)u"psi"
Wsolenoid = 1.5u"kg"
@@ -33,10 +30,10 @@ T = (300 ± 20)u"K"
t = 0.0u"s"
P = P0 |> u"Pa"
M = V * (P / (R * T)) |> u"kg"
# df = DataFrame(Thrust = (0 ± 0)u"N", Pressure = P, Time = t, Mass = M)
df = DataFrame()
ts = 10u"ms"
while M > 0.1u"kg"
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
P = minimum([P, Pmax])
@@ -49,25 +46,23 @@ while M > 0.1u"kg"
# Calculate what is still in the tank
M = M - * ts |> u"kg"
P = (M * R * T) / V |> u"Pa"
# df_step = DataFrame(Thrust = Thrust, Pressure = P, Time = t, Mass = M)
if df == DataFrame()
df = DataFrame(Thrust = Thrust, Pressure = P, Time = t, Mass = M)
else
append!(df, DataFrame(Thrust = Thrust, Pressure = P, Time = t, Mass = M))
end
t = t + ts
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: ", impulse)
println("Burn Time: ", t)
plot(impulse)
println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass))
# plot(sum(df.Thrust) * ts |> u"N*s")
# print(describe(df))
# df.Time = round(u"s", df.Time)
# plot(df.Time, df.Thrust, title = "Thrust Over Time")
# CSV.write("thrustdata.csv", df .|> ustrip)
# plot(df.Time .|> u"s" .|> ustrip, df.Thrust .|> u"N" .|> ustrip)> ustrip, df.Thrust .|> u"N" .|> ustrip)
print(describe(df))
plot(df.Time[1:150:end], df.Thrust[1:150:end], title = "Thrust Over Time")
savefig("ThrustCurve.png")