mirror of
https://gitlab.com/lander-team/air-prop-simulation.git
synced 2025-07-23 22:51:35 +00:00
init
This commit is contained in:
190
.gitignore
vendored
Normal file
190
.gitignore
vendored
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/vscode,python,julia
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=vscode,python,julia
|
||||||
|
|
||||||
|
### Julia ###
|
||||||
|
# Files generated by invoking Julia with --code-coverage
|
||||||
|
*.jl.cov
|
||||||
|
*.jl.*.cov
|
||||||
|
|
||||||
|
# Files generated by invoking Julia with --track-allocation
|
||||||
|
*.jl.mem
|
||||||
|
|
||||||
|
# System-specific files and directories generated by the BinaryProvider and BinDeps packages
|
||||||
|
# They contain absolute paths specific to the host computer, and so should not be committed
|
||||||
|
deps/deps.jl
|
||||||
|
deps/build.log
|
||||||
|
deps/downloads/
|
||||||
|
deps/usr/
|
||||||
|
deps/src/
|
||||||
|
|
||||||
|
# Build artifacts for creating documentation generated by the Documenter package
|
||||||
|
docs/build/
|
||||||
|
docs/site/
|
||||||
|
|
||||||
|
# File generated by Pkg, the package manager, based on a corresponding Project.toml
|
||||||
|
# It records a fixed state of all packages used by the project. As such, it should not be
|
||||||
|
# committed for packages, but should be committed for applications that require a static
|
||||||
|
# environment.
|
||||||
|
Manifest.toml
|
||||||
|
|
||||||
|
### Python ###
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
pytestdebug.log
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
doc/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
# .env
|
||||||
|
*.csv
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
|
||||||
|
.env/
|
||||||
|
.venv/
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
pythonenv*
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# operating system-related files
|
||||||
|
*.DS_Store #file properties cache/storage on macOS
|
||||||
|
Thumbs.db #thumbnail cache on Windows
|
||||||
|
|
||||||
|
# profiling data
|
||||||
|
.prof
|
||||||
|
|
||||||
|
|
||||||
|
### vscode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/vscode,python,julia
|
124
calcs.jl
Normal file
124
calcs.jl
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
### A Pluto.jl notebook ###
|
||||||
|
# v0.12.20
|
||||||
|
|
||||||
|
using Markdown
|
||||||
|
using InteractiveUtils
|
||||||
|
|
||||||
|
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
|
||||||
|
macro bind(def, element)
|
||||||
|
quote
|
||||||
|
local el = $(esc(element))
|
||||||
|
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
|
||||||
|
el
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# ╔═╡ 7d1e8730-81f7-11eb-0b4d-d7c878032280
|
||||||
|
begin
|
||||||
|
using Unitful
|
||||||
|
using Roots
|
||||||
|
using PlutoUI
|
||||||
|
end
|
||||||
|
|
||||||
|
# ╔═╡ d8461f50-833d-11eb-04f2-f9e262a97ba5
|
||||||
|
md"## Air Compressor Thrust Calcs"
|
||||||
|
|
||||||
|
# ╔═╡ 2a976cf0-833e-11eb-3892-03869a9b0acc
|
||||||
|
html"<button onclick='present()'>present</button>"
|
||||||
|
|
||||||
|
# ╔═╡ b0efd6c2-81f9-11eb-2aad-efc9bdd8c220
|
||||||
|
@bind diam Slider(0.1:.1:6.5, default=.5)
|
||||||
|
|
||||||
|
# ╔═╡ bc06c722-81fa-11eb-05ac-e38ac21ce27e
|
||||||
|
@bind p Slider(15:6000, default=126)
|
||||||
|
|
||||||
|
# ╔═╡ 99835750-81fe-11eb-3a7e-1132eb3cdd90
|
||||||
|
@bind w Slider(.5:.25:20, default=5)
|
||||||
|
|
||||||
|
# ╔═╡ a9f59000-81f7-11eb-15c0-4520acb6543f
|
||||||
|
begin
|
||||||
|
M = w*u"kg"
|
||||||
|
|
||||||
|
P_amb = 1u"atm"
|
||||||
|
P_c = p*u"psi"
|
||||||
|
|
||||||
|
d_nozzle = diam*u"mm"
|
||||||
|
a_nozzle = (pi/4)*d_nozzle^2
|
||||||
|
|
||||||
|
γ = 1.4
|
||||||
|
R = 287.05u"J/(kg * K)"
|
||||||
|
T = 300u"K"
|
||||||
|
|
||||||
|
burn_time = 5u"s"
|
||||||
|
|
||||||
|
V = 68u"inch^3"
|
||||||
|
end;
|
||||||
|
|
||||||
|
# ╔═╡ 764dcf30-81fa-11eb-3155-559823202b8f
|
||||||
|
md"Area of Nozzle: $(a_nozzle) | $(round(u\"inch^2\",a_nozzle, digits = 4))"
|
||||||
|
|
||||||
|
# ╔═╡ b4a957a0-833e-11eb-1ca9-0d87d162790f
|
||||||
|
md"Diameter of Nozzle: $(d_nozzle) | $(round(u\"inch\",d_nozzle, digits = 4))"
|
||||||
|
|
||||||
|
# ╔═╡ a7bef990-81fa-11eb-3976-817c3e383e64
|
||||||
|
md"Pressure of system: $(P_c)"
|
||||||
|
|
||||||
|
# ╔═╡ b113c030-81fe-11eb-2042-776472e720ac
|
||||||
|
md"Mass of Lander: $(M) | $(round(u\"lb\",M, digits = 2))"
|
||||||
|
|
||||||
|
# ╔═╡ a9317cb0-81f7-11eb-26e5-95719252409b
|
||||||
|
begin
|
||||||
|
ve = sqrt((2 * γ / (γ - 1)) * R * T * (1 - P_amb / P_c)^((γ - 1) / γ)) |> u"m/s"
|
||||||
|
|
||||||
|
ρ = P_c / (R * T) |> u"kg/m^3"
|
||||||
|
ṁ = ρ * a_nozzle * ve |> u"kg/s"
|
||||||
|
end;
|
||||||
|
|
||||||
|
# ╔═╡ cf5b7030-846d-11eb-2f23-290624c7d684
|
||||||
|
M_air = ρ*V |> u"kg"
|
||||||
|
|
||||||
|
# ╔═╡ 2149b640-846e-11eb-262b-299ded0c61c5
|
||||||
|
M_air / ṁ
|
||||||
|
|
||||||
|
# ╔═╡ c57fe2d0-81f7-11eb-27d7-4b5c0520998d
|
||||||
|
Thrust = ṁ * ve + a_nozzle * (P_c - P_amb) |> u"N"
|
||||||
|
|
||||||
|
# ╔═╡ 213ef2c0-81fb-11eb-1425-15bfcf1dc14c
|
||||||
|
volume_air = ṁ * burn_time / ρ |> u"inch^3";
|
||||||
|
|
||||||
|
# ╔═╡ 9388c570-833d-11eb-3baa-758b5cb19065
|
||||||
|
md"Air Needed: $(round(ustrip(volume_air/burn_time)*.004329,digits=3)) Gallon/s"
|
||||||
|
|
||||||
|
# ╔═╡ e85b0e90-81fe-11eb-0dd5-0b3df376a4f7
|
||||||
|
begin
|
||||||
|
W_earth = 9.81u"m/s^2" * M |> u"N"
|
||||||
|
W_moon = 1.623u"m/s^2" * M |> u"N"
|
||||||
|
end;
|
||||||
|
|
||||||
|
# ╔═╡ 57844480-833a-11eb-3a57-bf00cecde849
|
||||||
|
md"Thrust to Weight Ratio Earth: $(Thrust/W_earth)"
|
||||||
|
|
||||||
|
# ╔═╡ a5c735d0-833a-11eb-2bae-71ba4af6b3a1
|
||||||
|
md"Thrust to Weight Ratio Moon: $(Thrust/W_moon)"
|
||||||
|
|
||||||
|
# ╔═╡ Cell order:
|
||||||
|
# ╟─d8461f50-833d-11eb-04f2-f9e262a97ba5
|
||||||
|
# ╟─2a976cf0-833e-11eb-3892-03869a9b0acc
|
||||||
|
# ╟─7d1e8730-81f7-11eb-0b4d-d7c878032280
|
||||||
|
# ╟─764dcf30-81fa-11eb-3155-559823202b8f
|
||||||
|
# ╟─b4a957a0-833e-11eb-1ca9-0d87d162790f
|
||||||
|
# ╟─b0efd6c2-81f9-11eb-2aad-efc9bdd8c220
|
||||||
|
# ╟─a7bef990-81fa-11eb-3976-817c3e383e64
|
||||||
|
# ╠═bc06c722-81fa-11eb-05ac-e38ac21ce27e
|
||||||
|
# ╟─b113c030-81fe-11eb-2042-776472e720ac
|
||||||
|
# ╠═99835750-81fe-11eb-3a7e-1132eb3cdd90
|
||||||
|
# ╠═a9f59000-81f7-11eb-15c0-4520acb6543f
|
||||||
|
# ╠═a9317cb0-81f7-11eb-26e5-95719252409b
|
||||||
|
# ╠═2149b640-846e-11eb-262b-299ded0c61c5
|
||||||
|
# ╠═cf5b7030-846d-11eb-2f23-290624c7d684
|
||||||
|
# ╠═c57fe2d0-81f7-11eb-27d7-4b5c0520998d
|
||||||
|
# ╟─213ef2c0-81fb-11eb-1425-15bfcf1dc14c
|
||||||
|
# ╠═9388c570-833d-11eb-3baa-758b5cb19065
|
||||||
|
# ╟─e85b0e90-81fe-11eb-0dd5-0b3df376a4f7
|
||||||
|
# ╟─57844480-833a-11eb-3a57-bf00cecde849
|
||||||
|
# ╟─a5c735d0-833a-11eb-2bae-71ba4af6b3a1
|
33
mqttTest.py
Normal file
33
mqttTest.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
import pandas as pd
|
||||||
|
from influxdb_client import InfluxDBClient, Point, WritePrecision
|
||||||
|
from influxdb_client.client.write_api import SYNCHRONOUS
|
||||||
|
import influxdb_client
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
# You can generate a Token from the "Tokens Tab" in the UI
|
||||||
|
token = "RKOjpFKD2e9EUy79rB6pQEYmgmKaGnMy-4hMDnQ_pamEbrrfsMhcP2LjU7ufTRBSyFtRBSKVW5RnET6wq6qOag=="
|
||||||
|
org = "anson@ansonbiggs.com"
|
||||||
|
bucket = "anson's Bucket"
|
||||||
|
|
||||||
|
client = InfluxDBClient(
|
||||||
|
url="https://westeurope-1.azure.cloud2.influxdata.com", token=token
|
||||||
|
)
|
||||||
|
write_api = client.write_api(write_options=SYNCHRONOUS)
|
||||||
|
|
||||||
|
df = pd.read_csv("thrustdata.csv")
|
||||||
|
|
||||||
|
ps = []
|
||||||
|
for i, row in tqdm(df.iterrows(), total=len(df)):
|
||||||
|
data = dict(row)
|
||||||
|
ps.append(
|
||||||
|
influxdb_client.Point("my_measurement")
|
||||||
|
.tag("Thrust", "Test")
|
||||||
|
.field("Thrust", data["Thrust"])
|
||||||
|
.field("Pressure", data["Pressure"])
|
||||||
|
.field("Time", data["Time"])
|
||||||
|
.field("Mass", data["Mass"])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
write_api.write(bucket=bucket, org=org, record=ps)
|
59
thrust.jl
Normal file
59
thrust.jl
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Unitful
|
||||||
|
using DataFrames
|
||||||
|
using Plots
|
||||||
|
using UnitfulRecipes
|
||||||
|
using Roots
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
|
||||||
|
# Tank https://www.amazon.com/Empire-Paintball-BASICS-Pressure-Compressed/dp/B07B6M48SR/
|
||||||
|
V = 90u"inch^3"
|
||||||
|
P0 = 4500.0u"psi"
|
||||||
|
Wtank = 2.3u"lb"
|
||||||
|
Pmax = 100u"psi"
|
||||||
|
|
||||||
|
Wsolenoid = 1.5u"kg"
|
||||||
|
|
||||||
|
# Params
|
||||||
|
d_nozzle = (1 // 16) * u"inch"
|
||||||
|
a_nozzle = (pi / 4) * d_nozzle^2
|
||||||
|
Poutmax = 800u"psi"
|
||||||
|
|
||||||
|
# Universal Stuff
|
||||||
|
P_amb = 1u"atm"
|
||||||
|
γ = 1.4
|
||||||
|
R = 287.05u"J/(kg * K)"
|
||||||
|
T = 300u"K"
|
||||||
|
|
||||||
|
# Setting up while loop
|
||||||
|
t = 1.0u"s"
|
||||||
|
P = P0 |> u"Pa"
|
||||||
|
M = V * (P / (R * T)) |> u"kg"
|
||||||
|
df = DataFrame(Thrust = 0.0u"N", Pressure = P, Time = t, Mass = M)
|
||||||
|
ts = 0.001u"s"
|
||||||
|
while M > 0.01u"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
|
||||||
|
println("---------------------------\n\n\n\n")
|
||||||
|
println("Total Impulse: ", sum(df.Thrust) * ts)
|
||||||
|
println("Burn Time: ", t)
|
||||||
|
println("Mass Total: ", Wtank + Wsolenoid + maximum(df.Mass))
|
||||||
|
|
||||||
|
print(describe(df))
|
||||||
|
plot(df.Time, df.Thrust, title = "Thrust Over Time")
|
||||||
|
CSV.write("thrustdata.csv", df .|> ustrip)
|
Reference in New Issue
Block a user