draftply Download

dB & Power Converter

← All samples

db-power-converter.dplyEditor
1---
2app_version: 0.1.0
3precision: 3
4form_title: dB & Power Converter
5form_description: Convert between power ratios, dB, watts and dBm — and see roughly what an S-meter reading means in dBm.
6form_inputs: Power ratio|ratio, Transmitter power (W)|watts, Received signal (dBm)|received_dbm
7form_outputs: Ratio as dB|ratio_db, Transmitter power (dBm)|dbm_watts, Approx. S-meter reading|s_units
8---
9# dB & Power Converter
10// "Is +3 dB really double the power? And what's S9 in dBm?"
11
12# Ratio ↔ dB
13ratio = 2 // e.g. a power doubling
14ratio_db = db(ratio) // 10 * log10(ratio)
15
16"Ratio": ratio
17"...as dB": ratio_db
18"Back to a ratio": db2ratio(ratio_db)
19
20// A voltage/current ratio needs the ×20 form instead of ×10 — squaring it
21// first turns it into a power ratio, so db() handles both with one function.
22voltage_ratio = 2
23"Voltage ratio, as dB": db(voltage_ratio^2)
24
25# Watts ↔ dBm
26// dBm is power relative to 1 mW — the scale radios, receivers and antenna
27// analyzers actually print.
28watts = 100 // a typical HF rig at full power
29dbm_watts = dbm(watts)
30
31"Transmitter power (W)": watts
32"...as dBm": dbm_watts
33"5 W handheld, in dBm": dbm(5)
34"QRP 5 W, back to watts (round-trip)": dbm2w(dbm(5))
35
36# Rough S-meter reference
37// Not a formal standard, just the common rule of thumb: S9 is -73 dBm on HF,
38// each S-unit below that is 6 dB weaker, and "+dB over S9" is exactly that.
39s9_dbm = -73
40received_dbm = -95 // a signal report you want to translate
41
42s_units = (received_dbm - s9_dbm) / 6 + 9
43
44"Received signal (dBm)": received_dbm
45"Approx. S-meter reading": s_units
46