lora

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PacketConfigDefault = PacketConfig{
	PayloadLen:              1,
	PreambleLen:             6,
	SpreadingFactor:         7,
	BandWidth:               125,
	CodingRate:              5,
	CRC:                     false,
	ExplicitHeader:          false,
	LowDataRateOptimization: false,
}

PacketConfigDefault represents a default packet config.

Functions

func FSPL

func FSPL(distance float64, freq float64) float64

FSPL represents the Free-space path loss based on a distance and the frequency (in MHz) of a signal.

https://en.wikipedia.org/wiki/Free-space_path_loss

func LogDistance

func LogDistance(distance float64, distanceRef float64, gamma float64, freq float64) float64

LogDistance represents the log-distance path loss model.

- distance is the distance between the nodes - distanceRef is the reference distance in the same unit as distance (usually 1 km (or 1 mile) for a large cell and 1 m to 10 m for a microcell) - gamma is the path loss exponent (example values are: free space = 2, urban area = 2.7 - 3.5, obstructed in building = 4 - 6) - freq is the frequency at which the signal is sent

https://en.wikipedia.org/wiki/Log-distance_path_loss_model

Types

type PacketConfig

type PacketConfig struct {
	PayloadLen              float64 `json:"payloadLen"`
	PreambleLen             float64 `json:"preambleLen"`
	SpreadingFactor         float64 `json:"spreadingFactor"`
	BandWidth               float64 `json:"bandWidth"`
	CodingRate              float64 `json:"codingRate"`
	CRC                     bool    `json:"crc"`
	ExplicitHeader          bool    `json:"explicitHeader"`
	LowDataRateOptimization bool    `json:"lowDataRateOptimization"`
}

PacketConfig represents a LoRa packet configuration that is needed to calculate the airtime.

func (PacketConfig) NPayload

func (pc PacketConfig) NPayload() float64

func (PacketConfig) NPreamble

func (pc PacketConfig) NPreamble() float64

func (PacketConfig) PayloadValid

func (pc PacketConfig) PayloadValid() bool

func (PacketConfig) PreambleValid

func (pc PacketConfig) PreambleValid() bool

func (PacketConfig) SymbolRate

func (pc PacketConfig) SymbolRate() float64

func (PacketConfig) SymbolTime

func (pc PacketConfig) SymbolTime() float64

func (PacketConfig) Throughput

func (pc PacketConfig) Throughput() float64

func (PacketConfig) TimePayload

func (pc PacketConfig) TimePayload() float64

TimePayload represents the time the payload alone will be on air.

func (PacketConfig) TimePreamble

func (pc PacketConfig) TimePreamble() float64

TimePreamble represents the time the preamble alone will be on air.

func (PacketConfig) TimeTotal

func (pc PacketConfig) TimeTotal() float64

TimeTotal represents the total time the packet will be on air.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL