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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ htmlcov/
# build artifacts
*.egg-info/
dist/

# Validation downloads and results (validation/apc_uiuc.py)
validation/.cache/
validation/results/
Binary file added docs/images/validation/bias_by_size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/validation/errors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/validation/operating_points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Electric UAV propulsion design usually crosses several domains: aerodynamics, mo

- **Manufacturer data**

Read APC performance files, or QPROP propeller and motor files for a blade-element model, and enter motor datasheet constants, instead of sizing only against abstract component assumptions.
Read APC performance files, QPROP propeller and motor files or APC and UIUC geometry files for a blade-element model, and enter motor datasheet constants, instead of sizing only against abstract component assumptions.

- **Battery-aware analysis**

Expand Down
118 changes: 113 additions & 5 deletions docs/reference/blade_element_propeller.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,115 @@ and uses `R` as written, so a file that gives `R` with `Rfac` other than 1 or
Without `R`, or with the radii in metres, the two agree. `R` must not be less
than the last station's radius.

## UIUC Geometry Files

The [UIUC Propeller Database](https://m-selig.ae.illinois.edu/props/propDB.html)
gives the measured geometry of many small propellers next to their wind-tunnel
data. A geometry file, such as `apce_10x5_geom.txt`, has a header line
`r/R c/R beta` and one station per line from root to tip: radius and chord as
fractions of the tip radius, and the blade angle in degrees.

The file gives neither the diameter, the blade count nor the airfoil, so
`pythrust.io.read_uiuc_geometry` takes them as arguments; the one `section`
applies to every station:

```python
from pythrust.io import read_uiuc_geometry
from pythrust.propeller import BladeElementPropeller, BladeSection

# The example section of the QPROP user guide, a generic starting point.
section = BladeSection(
cl0=0.50, cl_alpha_per_rad=5.8, cl_min=-0.3, cl_max=1.2,
cd0=0.028, cd2_upper=0.050, cd2_lower=0.020, cl_at_cd0=0.5,
reynolds_ref=70000.0, reynolds_exp=-0.7,
)
blade = read_uiuc_geometry("apce_10x5_geom.txt", diameter_m=0.254, section=section)
propeller = BladeElementPropeller(blade)
```

The section parameters set the accuracy. With the generic section above, the
APC Thin Electric 10x5 gives a static thrust coefficient 7–15% above the UIUC
measurement and a power coefficient 16–42% above it, the largest gap at the
lowest RPM. Section parameters fitted to the propeller's airfoil narrow the gap.

## APC Geometry Files

APC publishes a geometry file for each propeller, such as `10x5E-PERF.PE0`, on
its [technical data page](https://www.apcprop.com/propeller-technical-data/).
The file gives the chord and blade angle (`TWIST`) at about 50 stations in
inches, the tip radius, the hub transition radius, the blade count, and the
two airfoils of the blade: the first up to a transition start radius, the
second from a transition end radius. APC's thin electric propellers, for
example, go from an Eppler E63 to the APC12, equivalent to a NACA 4412.

`pythrust.io.read_apc_geometry` reads the stations from the hub transition
outward. The blade angle is that of the chord line, between the leading- and
trailing-edge mold parting lines; the file's `TWIST` column matches its `LE-TE`
pitch, not the lower `PRATHER` pitch a gauge on the lower surface would read.

`sections` is one section for the whole blade, or a mapping from the file's
airfoil names to sections. `apc_airfoil_polars()` gives the
[polars](#airfoil-polars) of the airfoils APC names, E63, APC12 and CLARK-Y,
computed with NeuralFoil:

```python
from pythrust.io import read_apc_geometry
from pythrust.propeller import BladeElementPropeller, apc_airfoil_polars

blade = read_apc_geometry("10x5E-PERF.PE0", apc_airfoil_polars())
propeller = BladeElementPropeller(blade)
```

Between the two transition radii the stations mix the two airfoils: polars in a
`BlendedPolar`, `BladeSection` parameters linearly.

Against UIUC's wind-tunnel measurements of 75 APC propellers, this model is
about as accurate as APC's own performance tables: some 10% mean error per
propeller in thrust and power, less than the tables' in thrust. See
[Validation](validation.md).

## Airfoil Polars

An `AirfoilPolar` tabulates an airfoil's lift and drag coefficients against
angle of attack and Reynolds number. `AirfoilPolar.from_neuralfoil` computes
them with [NeuralFoil](https://github.com/Setuav/NeuralFoil), a neural network
trained on XFOIL results, from a NACA 4- or 5-digit designation, a Selig or
Lednicer `.dat` file, or coordinates:

```python
from pythrust.propeller import AirfoilPolar

naca = AirfoilPolar.from_neuralfoil("NACA 4412")
e387 = AirfoilPolar.from_neuralfoil("e387.dat")
cl, cd = naca.coefficients(alpha_rad=0.1, reynolds=8e4, mach=0.1)
```

- NeuralFoil gives the table from -20 to 25 degrees, every 0.5 degree, at 13
Reynolds numbers from 1e4 to 1e6. Beyond -35 and 40 degrees the section is
a flat plate, $c_l = \sin 2\alpha$ and $c_d = 2 \sin^2 \alpha$. Between the
table's points the coefficients are interpolated linearly in the angle of
attack and in $\log Re$; beyond its Reynolds numbers the nearest is used.
- The angle of attack is from the chord line.
- Lift is divided by $\sqrt{1 - M^2}$ (Prandtl-Glauert).
- `n_crit` is the amplification factor at which the boundary layer turns
turbulent: 9 for a quiet wind tunnel, lower for a turbulent free stream.
The default, 7, fits the [validation](validation.md) measurements best.
- Building one table takes about 0.2 s; `apc_airfoil_polars()` caches its
polars per `n_crit`.

A blade's sections are all `BladeSection` or all polars. The analysis stations
mix the polars of the two nearest geometry stations linearly. A solved
operating point of the APC 10x5E takes about 60 ms.

## API

### Blade Geometry

`pythrust.io.read_qprop_propeller(path)` reads a QPROP propeller file into a
`BladeGeometry`, the input of a blade-element propeller model:
`pythrust.io.read_qprop_propeller(path)` reads a QPROP propeller file,
`pythrust.io.read_uiuc_geometry(path, diameter_m, section, blade_count=2)` a
UIUC geometry file, and `pythrust.io.read_apc_geometry(path, sections)` an APC
geometry file into a `BladeGeometry`, the input of a blade-element propeller
model:

| Field | Unit | Description |
|---|---:|---|
Expand All @@ -82,10 +185,11 @@ than the last station's radius.
| `r_m` | m | Station radii, root to tip |
| `chord_m` | m | Chord at each station |
| `blade_angle_rad` | rad | Blade angle from the plane of rotation at each station |
| `sections` | - | `BladeSection` at each station |
| `sections` | - | `BladeSection`, `AirfoilPolar` or `BlendedPolar` at each station |

`BladeSection` holds QPROP's airfoil parameters, listed with their symbols in
[Section lift and drag](#section-lift-and-drag).
[Section lift and drag](#section-lift-and-drag); `AirfoilPolar` and
`BlendedPolar` are [tabulated polars](#airfoil-polars).
`section_coefficients(section, alpha_rad, reynolds, mach)` evaluates the section
model on scalars or NumPy arrays and returns `(CL, CD)`.

Expand Down Expand Up @@ -257,9 +361,13 @@ ratio at which the section at 75% radius has zero lift, ignoring the induced
velocity, which is small near zero thrust:

$$
J_{\max} = \pi \, \frac{r_{75}}{R_{\text{tip}}} \tan\left(\beta_{75} + \frac{c_{l0}}{c_{l\alpha}}\right)
J_{\max} = \pi \, \frac{r_{75}}{R_{\text{tip}}} \tan\left(\beta_{75} - \alpha_{0}\right)
$$

where $\alpha_0$ is the section's zero-lift angle: $-c_{l0}/c_{l\alpha}$ for a
`BladeSection`, and for a polar the lowest over its Reynolds numbers, so that
the search starts past zero thrust.

### Differences from QPROP

- **Tip radius scaling.** A QPROP propeller file may give the tip radius on its
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/propellers.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ a manufacturer's file and pick the model that reads it.
| Model | Input | Page |
|---|---|---|
| `TablePropeller` | Tabulated thrust and power coefficients, such as an APC performance file | [Tabulated Propeller](table_propeller.md) |
| `BladeElementPropeller` | Blade geometry and airfoil parameters, such as a QPROP propeller file | [Blade-Element Propeller](blade_element_propeller.md) |
| `BladeElementPropeller` | Blade geometry and airfoil data, from a QPROP propeller file or an APC or UIUC geometry file, with QPROP section parameters or NeuralFoil polars | [Blade-Element Propeller](blade_element_propeller.md) |

## Model Interface

Expand Down
103 changes: 103 additions & 0 deletions docs/reference/validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Validation

How close PyThrust's propeller models come to wind-tunnel measurements, for every APC propeller
that the [UIUC Propeller Database](https://m-selig.ae.illinois.edu/props/propDB.html) measured
and APC publishes a geometry file for: 75 propellers, 7 to 21 inches, in three families.

| Family | Propellers | Airfoils |
|---|---:|---|
| Thin Electric (E) | 34 | E63 at the root to APC12 (NACA 4412) |
| Sport | 30 | CLARK-Y |
| Slow Flyer (SF) | 11 | E63, or E63 to APC12 |

## Method

Four propeller models are compared with UIUC's static tests (thrust and power coefficients
against RPM) and forward-flight runs (against advance ratio, at a few RPM each):

- **Blade-element model, NeuralFoil polars**: APC's geometry file read with
`read_apc_geometry(path, apc_airfoil_polars(n_crit))`.
- **Blade-element model, generic section**: the same geometry with the example section of the
QPROP user guide on every station.
- **APC table**: APC's own performance file, read with `read_apc`. It is a computation, not a
measurement.

`n_crit` was chosen on every third propeller of each family (26) and the models compared on the
other 49. The error of a propeller is the mean over its points; forward points with a measured
thrust coefficient below 0.02 are left out, where relative errors lose meaning.

## Coefficients

Mean absolute error per propeller, the 49 test propellers (efficiency in percentage points):

| Model | Static $C_T$ | Static $C_P$ | Forward $C_T$ | Forward $C_P$ | Forward efficiency |
|---|---:|---:|---:|---:|---:|
| Generic section | 9.6% | 14.3% | 20.0% | 16.7% | 4.7 |
| NeuralFoil, `n_crit` 9 | 13.3% | 12.5% | 17.1% | 14.3% | 5.3 |
| **NeuralFoil, `n_crit` 7** | **9.2%** | 13.5% | **12.3%** | 11.5% | 5.5 |
| APC table | 14.5% | 12.5% | 16.0% | 11.3% | 4.0 |

![Error per propeller](../images/validation/errors.png)

- With NeuralFoil polars the blade-element model is about as accurate as APC's own tables, and
better in thrust.
- `n_crit` 7 and 5 fit equally well (mean errors 11.58% and 11.59% on the calibration set); 9,
for a quiet wind tunnel, makes the slow, low-Reynolds-number points lose too much lift. The
default is 7.
- The model's and APC's errors go together: per propeller their static power errors correlate at
0.93, their thrust errors at 0.6 to 0.7. Much of what is left is common to both computations.

## By family

Mean signed error over all propellers of a family:

| Family | Model | Static $C_T$ | Static $C_P$ | Forward $C_T$ | Forward $C_P$ |
|---|---|---:|---:|---:|---:|
| Thin Electric | NeuralFoil, `n_crit` 7 | −3.7% | −6.1% | −2.5% | −1.6% |
| | APC table | +3.1% | −4.7% | +0.2% | +3.1% |
| Sport | NeuralFoil, `n_crit` 7 | −6.1% | −20.0% | −3.7% | −14.5% |
| | APC table | +13.6% | −14.6% | +10.0% | −0.5% |
| Slow Flyer | NeuralFoil, `n_crit` 7 | +10.6% | +7.1% | −17.1% | −9.0% |
| | APC table | +17.9% | +11.4% | +9.0% | +9.6% |

![Bias by size and family](../images/validation/bias_by_size.png)

- **Thin Electric**: within a few percent on average.
- **Sport**: the model gives 15 to 20% too little power; APC's table, 15% too little static
power.
- **Slow Flyer**: forward thrust 17% low. These thin, flexible blades bend under load, which
neither computation models; expect errors of 15 to 20%.

## Operating points

With a fixed-voltage battery and a motor whose no-load speed is 1.25 times the propeller's median
static test RPM, at full throttle, static and at an advance ratio of 0.3, the measured table being
the truth (49 test propellers, mean absolute error):

| Model | Static current | Static thrust | Cruise current | Cruise thrust |
|---|---:|---:|---:|---:|
| Generic section | 8.9% | 7.9% | 10.4% | 11.1% |
| NeuralFoil, `n_crit` 7 | 11.2% | 7.8% | 7.4% | 8.3% |
| APC table | 11.0% | 12.3% | 6.7% | 12.6% |

![Operating points](../images/validation/operating_points.png)

The motor holds the RPM within 0.3%, so the power error shows in the current and the thrust error
in the thrust, each somewhat smaller than in the coefficients.

## Range

The measurements cover APC propellers of 7 to 21 inches, mostly below 8000 RPM. Above that, on
APC's own grid of RPM and advance ratio, the model gives 5 to 10% more thrust and power than
APC's tables, with no measurement to say which is right. The section lift has the
Prandtl-Glauert factor but the drag does not rise as the tip nears the speed of sound, so results
at high tip Mach numbers are outside what was validated.

## Reproducing

```bash
PYTHONPATH=. python validation/apc_uiuc.py # downloads into validation/.cache
PYTHONPATH=. python validation/report.py # tables, and the figures on this page
```

The data is downloaded from UIUC and APC on the first run and not kept in the repository.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ nav:
- Battery: reference/battery.md
- Propulsion Solver: reference/propulsion_solver.md
- OpenMDAO: reference/openmdao.md
- Validation: reference/validation.md
- Developer Guide:
- Development & Testing: development.md
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ requires-python = ">=3.10"
dependencies = [
"numpy>=1.20",
"scipy>=1.7",
"setuav-neuralfoil>=0.3.3.1",
]

[project.optional-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion pythrust/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Readers for propeller and motor data files."""

from .apc import read_apc # noqa: F401
from .apc import read_apc, read_apc_geometry # noqa: F401
from .qprop import read_qprop_motor, read_qprop_propeller # noqa: F401
from .uiuc import read_uiuc_geometry, read_uiuc_performance # noqa: F401
Loading
Loading