Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

env:
PYTHON_VERSION: "3.12"
UV_LOCKED: "1"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3"

- name: Install dependencies
run: uv sync

- name: Format, lint, and type-check
run: task format

- name: Fail if formatting changed files
run: git diff --exit-code

test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3"

- name: Install dependencies
run: uv sync

- name: Run tests
run: task test
173 changes: 173 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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
.coveragerc
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# 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/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# 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/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea
.idea?
.DS_Store
.DS_Store?

# pixi environments
.pixi
*.egg-info

/logs/log_*
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ci:
skip: [pytest]

default_language_version:
python: python3.12

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: [types-pyyaml]
exclude: ^testing/resources/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: ruff
types_or: [python, pyi]
args: [--fix]
- id: ruff-format
types_or: [python, pyi]
args: [--line-length=88]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
51 changes: 0 additions & 51 deletions AeroDrag.py

This file was deleted.

23 changes: 0 additions & 23 deletions Airfoil.py

This file was deleted.

40 changes: 40 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What this is

A generative design tool for the *initial design phase* of a tiltrotor (VTOL) UAV. Given a set of aircraft constraints in `inputs.csv` (mass, span, airfoil coefficients, thickness ratio), it sweeps wingspan and cruise velocity to model drag, hover power, structural limits, and battery sizing, then reports the design that maximizes flight range and plots the trade-space.

The package name is `uav_design`. It models skin-friction, form, and induced drag; disk-loading hover power; FAA structural loading limits via Euler beam theory; taper/induced drag; and battery considerations for electric flight.

## Commands

Uses uv + a Taskfile (go-task). Python 3.12. Runtime deps in `[project.dependencies]`; dev tooling (pytest, ruff, mypy, pre-commit) in `[dependency-groups.dev]`.

```bash
task init # uv sync + install pre-commit hooks
task run # run the design sweep over inputs.csv and show plots
task format # ruff format + ruff check --fix + mypy
task test # pytest with coverage over uav_design/
task ci # format + test (local CI mirror)
task clean # remove .venv, caches, build artifacts
```

Run a single test:
```bash
uv run pytest tests/structures_test.py -v
```

## Layout

- `uav_design/` — the package.
- `__main__.py` — the design sweep: reads `inputs.csv`, iterates over wingspan/velocity, computes the trade-space, prints the optimal aircraft details, and plots flight radius and hover time. Run with `python -m uav_design`.
- `read_inputs.py` — parses `inputs.csv` into the constraint vector.
- `aero_drag.py` — total, parasitic (skin-friction), and induced drag.
- `hover.py` — hover power (disk loading) and take-off/landing energy.
- `structures.py` — Euler beam theory: moments of area, point/uniform/triangle loads, torsion and bending strain.
- `wing_calculations.py` — iterative wing-mass minimization against the strain limit.
- `airfoil.py` — standalone NACA-style airfoil profile plot.
- `inputs.csv` — the aircraft constraints you edit to tailor a design.
- `tests/` — pytest suite mirroring the package modules.
Loading
Loading