1---
2app_version: 0.5.0
3---
4# rf-extras.dplylib
5// Antenna-gain conversions that don't fit defunit(): dBi and dBd are
6// logarithmic, related by a fixed *offset*, not a linear factor — the same
7// reason db()/dbm() are built-in functions rather than units.
8//
9// dBd = dBi − 2.15 (an isotropic radiator has 2.15 dB more gain than a
10// reference half-wave dipole).
11//
12// Pro: a reusable function (def) is itself a Pro feature — the free tier can
13// still open and read this file, but calling dbi_to_dbd()/dbd_to_dbi() needs
14// a Pro trial or purchase, same as any other library built around def/class.
15
16def dbi_to_dbd(g):
17 return g - 2.15
18
19def dbd_to_dbi(g):
20 return g + 2.15
21
22# Quick examples (visible when you open this file directly)
23dbi_to_dbd(9) // 6.85 — a typical 9 dBi omni antenna, in dBd
24dbd_to_dbi(6.85) // 9 — round-trips back to dBi
25