Documentation
¶
Index ¶
- Constants
- func BullingtonFigure12Method(p1, p2 float64, d Distance, terrain []float64) (d1, d2, height float64)
- func CalculateFresnelKirckoffDiffractionParam(freq Frequency, d1, d2, h Distance) (v float64, err error)
- func DecibelMilliVoltToMilliWatt(dbm float64) float64
- func FresnelFirstZoneMax(freq Frequency, dist Distance) (float64, error)
- func FresnelPoint(d1, d2 Distance, freq Frequency, order int64) (float64, error)
- func GraphBullingtonFigure12(filename string, normalised bool, p1, p2 float64, d Distance, ...) error
- func MilliWattToDecibelMilliVolt(mw float64) float64
- func Smooth(data []float64) []float64
- func SmoothN(n int, data []float64) []float64
- func TerrainToPath(p1, p2 float64, d Distance, terrain []float64) (Δd, Δh, θ float64, diffs []float64)
- func TerrainToPathXY(p1, p2 float64, d Distance, terrain []float64) (x, y []float64, d2 float64)
- func UnNormalisePoint(p1, p2 float64, d Distance, x, y float64) (float64, float64)
- type Attenuation
- func CalculateFoliageLoss(freq Frequency, depth Distance) (Attenuation, error)
- func CalculateFreeSpacePathLoss(freq Frequency, distance Distance) Attenuation
- func CalculateFresnelKirchoffLossApprox(v float64) (Attenuation, error)
- func CalculateRaleighFading(freq Frequency) (Attenuation, error)
- func CalculateRicanFading(freq Frequency) (Attenuation, error)
- func CalculateWeibullFading(freq Frequency) (Attenuation, error)
- func FieldAbsToDB(abs float64) Attenuation
- type Distance
- type Frequency
- type Wavelength
Constants ¶
const ( //C is the speed of light in air in meters per second C = 2.998e+8 // FresnelObstructionOK is the largest acceptable proportion of fresnel zone impingement FresnelObstructionOK = 0.4 // FresnelObstructionIdeal is the largest ideal proportion of fresnel zone impingement FresnelObstructionIdeal = 0.2 // R is the (average) radius of the earth R = 6.371e6 )
const ( Hz Frequency = 1.0 KHz = Hz * 1000 MHz = KHz * 1000 GHz = MHz * 1000 )
Frequency helper types
const ( WeissbergerMinFreq = 230 * MHz WeissbergerMaxFreq = 95 * GHz WeissbergerMinDist = 0 * M WeissbergerMaxDist = 400 * M )
const FresnelMinDistanceWavelengthRadio = 0.1
FresnelMinDistanceWavelengthRadio is the minimum ratio of distance:wavelength for viable calculations This is used as a programattic sanity check for distance >> wavelength
Variables ¶
This section is empty.
Functions ¶
func BullingtonFigure12Method ¶ added in v0.1.1
func BullingtonFigure12Method(p1, p2 float64, d Distance, terrain []float64) (d1, d2, height float64)
BullingtonFigure12Method implements the Bullington Figure 12 (intersecting horizons) method to approximate height and distance for use in the Fresnell-Kirchoff path loss approximation. Note that this implementation is not accurate for most negative (below LOS) impingements See: https://hams.soe.ucsc.edu/sites/default/files/Bullington%20VTS%201977.pdf
func CalculateFresnelKirckoffDiffractionParam ¶ added in v0.1.1
func CalculateFresnelKirckoffDiffractionParam(freq Frequency, d1, d2, h Distance) (v float64, err error)
CalculateFresnelKirckoffDiffractionParam Calculates the Fresnel-Kirchoff Diffraction parameter d1 and d2 are the distances between the "knife edge" impingement and the transmitter/receiver h is the impingement, where -ve is below Line of Sight (LoS) and +ve is above LoS https://en.wikipedia.org/wiki/Kirchhoff%27s_diffraction_formula https://s.campbellsci.com/documents/au/technical-papers/line-of-sight-obstruction.pdf
func DecibelMilliVoltToMilliWatt ¶
DecibelMilliVoltToMilliWatt converts dBm to mW Note that this power decibels (10log10)
func FresnelFirstZoneMax ¶
FresnelFirstZoneMax calculates the maximum fresnel zone radius for a given frequency
func FresnelPoint ¶
FresnelPoint calculates the fresnel zone radius d for a given wavelength and order at a point P between endpoints
func GraphBullingtonFigure12 ¶ added in v0.2.2
func GraphBullingtonFigure12(filename string, normalised bool, p1, p2 float64, d Distance, terrain []float64) error
GraphBullingtonFigure12 Graphs the terrain impingement calculated using the Bullington Figure 12 method
func MilliWattToDecibelMilliVolt ¶
MilliWattToDecibelMilliVolt converts mW to dBm Note that this power decibels (10log10)
func TerrainToPath ¶ added in v0.1.1
func TerrainToPath(p1, p2 float64, d Distance, terrain []float64) (Δd, Δh, θ float64, diffs []float64)
Convert terrain between two points of set heights into distances from the path between those points
func TerrainToPathXY ¶ added in v0.1.1
TerrainToPathXY Converts terrain between two points of set heights into distances from the path between those points
Types ¶
type Attenuation ¶ added in v0.1.1
type Attenuation float64
Attenuation type (dB) to assist with unit coherence
const (
DB Attenuation = 0
)
Attenuation helpers
func CalculateFoliageLoss ¶
func CalculateFoliageLoss(freq Frequency, depth Distance) (Attenuation, error)
CalculateFoliageLoss calculates path loss in dB due to foliage based on the Weissberger model https://en.wikipedia.org/wiki/Weissberger%27s_model
func CalculateFreeSpacePathLoss ¶ added in v0.1.1
func CalculateFreeSpacePathLoss(freq Frequency, distance Distance) Attenuation
CalculateFreeSpacePathLoss calculates the Free Space Path Loss in Decibels for a given frequency and distance
func CalculateFresnelKirchoffLossApprox ¶ added in v0.1.1
func CalculateFresnelKirchoffLossApprox(v float64) (Attenuation, error)
CalculateFresnelKirchoffLossApprox Calculates approximate loss due to diffraction using the Fresnel-Kirchoff Diffraction parameter. This approximate is valid for values >= -0.7 https://s.campbellsci.com/documents/au/technical-papers/line-of-sight-obstruction.pdf
func CalculateRaleighFading ¶
func CalculateRaleighFading(freq Frequency) (Attenuation, error)
CalculateRaleighFading calculates Raleigh fading https://en.wikipedia.org/wiki/Rayleigh_fading
func CalculateRicanFading ¶
func CalculateRicanFading(freq Frequency) (Attenuation, error)
CalculateRicanFading calculates Rican fading https://en.wikipedia.org/wiki/Rician_fading
func CalculateWeibullFading ¶
func CalculateWeibullFading(freq Frequency) (Attenuation, error)
CalculateWeibullFading calculates Weibull fading https://en.wikipedia.org/wiki/Weibull_fading
func FieldAbsToDB ¶ added in v0.1.1
func FieldAbsToDB(abs float64) Attenuation
FieldAbsToDB Converts an absolute field attenuation (20log10) to decibels
func (*Attenuation) FieldDBToAbs ¶ added in v0.1.1
func (a *Attenuation) FieldDBToAbs() float64
FieldDBToAbs Converts field attenuation (20log10) to absolute values
type Distance ¶
type Distance float64
Distance type (m) to assist with unit coherence
func CalculateDistance ¶
CalculateDistance calculates the distance between two latitude and longitudes Using the haversine (flat earth) formula See: http://www.movable-type.co.uk/scripts/latlong.html
func CalculateDistanceLOS ¶
CalculateDistanceLOS calculates the approximate Line of Sight distance between two lat/lon/alt points This achieves this by wrapping the haversine formula with a flat-earth approximation for height difference. This will be very inaccurate with larger distances. TODO: surely there is a better (ie. not written by me) algorithm for this
type Frequency ¶
type Frequency float64
Frequency type (Hz) to assist with unit coherence
func WavelengthToFrequency ¶
func WavelengthToFrequency(wavelength Wavelength) Frequency
WavelengthToFrequency calculates a frequency from a wavelength
type Wavelength ¶ added in v0.1.1
type Wavelength float64
Wavelength type (m) to assist with unit coherence
func FrequencyToWavelength ¶
func FrequencyToWavelength(freq Frequency) Wavelength
FrequencyToWavelength calculates a wavelength from a frequency