mirror of
https://gitlab.com/lander-team/air-prop-simulation.git
synced 2025-07-23 22:51:35 +00:00
make plot prettier
This commit is contained in:
BIN
ThrustCurve.png
BIN
ThrustCurve.png
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
18
thrust.jl
18
thrust.jl
@@ -1,9 +1,11 @@
|
|||||||
using Unitful
|
using Unitful
|
||||||
using DataFrames
|
using DataFrames
|
||||||
using Plots
|
using Plots
|
||||||
|
theme(:ggplot2);
|
||||||
using UnitfulRecipes
|
using UnitfulRecipes
|
||||||
using CSV
|
using CSV
|
||||||
using Measurements
|
using Measurements
|
||||||
|
using Measurements: value, uncertainty
|
||||||
using Printf
|
using Printf
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ t = 0.0u"s"
|
|||||||
P = P0 |> u"Pa"
|
P = P0 |> u"Pa"
|
||||||
M = V * (P / (R * T)) |> u"kg"
|
M = V * (P / (R * T)) |> u"kg"
|
||||||
ts = 1u"ms"
|
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 M > 0.005u"kg"
|
||||||
# while t < 30u"s"
|
# while t < 30u"s"
|
||||||
@@ -47,7 +49,7 @@ while M > 0.005u"kg"
|
|||||||
P = (M * R * T) / V |> u"Pa"
|
P = (M * R * T) / V |> u"Pa"
|
||||||
t = t + ts
|
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)
|
append!(df, df_step)
|
||||||
end
|
end
|
||||||
final_time = t |> u"s"
|
final_time = t |> u"s"
|
||||||
@@ -61,7 +63,17 @@ println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass))
|
|||||||
|
|
||||||
print(describe(df))
|
print(describe(df))
|
||||||
|
|
||||||
plot(df.Time[1:350:end], df.Thrust[1:350:end], title = "Thrust Over Time")
|
thrust_values = df.Thrust .|> ustrip .|> value
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
|
||||||
### Save data to readme.md
|
### Save data to readme.md
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user