lora airtime
lora_airtimeCalculates LoRa packet time-on-air using the Semtech AN1200.13 formula. Computes symbol duration, preamble time, payload symbol count, effective data rate, and the minimum transmission interval for 1% duty cycle compliance. Essential for capacity planning in LoRaWAN and Meshtastic mesh networks. Accepts spreading factor (SF7-SF12), bandwidth (125/250/500 kHz), coding rate (4/5-4/8), payload size, header mode, CRC, and optional low data rate optimization. Feeds airtime_ms to channel_utilization for mesh load analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cr | No | LoRa coding rate denominator (5-8). Represents 4/5 through 4/8 FEC ratio. | |
| sf | No | LoRa spreading factor (7-12). Higher SF = longer range but slower data rate. | |
| crc | No | Whether CRC is appended to payload. Recommended true for reliability. | |
| bw_khz | No | LoRa channel bandwidth in kHz. Common values: 125, 250, or 500. | |
| payload_bytes | Yes | Application payload size in bytes (0-255). | |
| explicit_header | No | Whether to use explicit header mode. True for LoRaWAN; false for implicit header. | |
| preamble_symbols | No | Number of preamble symbols. LoRaWAN uses 8; raw LoRa may vary. | |
| low_data_rate_optimize | No | Enable low data rate optimization. Auto-calculated if omitted: enabled for SF >= 11 at BW 125 kHz. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| airtime_ms | Yes | Total packet time-on-air in milliseconds. | |
| data_rate_bps | Yes | Effective data rate in bits per second. | |
| symbol_time_ms | Yes | Duration of a single LoRa symbol in milliseconds. | |
| payload_symbols | Yes | Number of symbols used for the payload + header portion. | |
| preamble_time_ms | Yes | Preamble duration in milliseconds (includes 4.25 sync symbols). | |
| duty_cycle_1pct_interval_s | Yes | Minimum interval between transmissions in seconds to respect 1% duty cycle regulation. |